UNPKG

qt-public-ui

Version:

新设计规范下业务组件库

48 lines 2.21 kB
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; import _regeneratorRuntime from "@babel/runtime/regenerator"; import React from 'react'; import { mount } from 'enzyme'; import { Collapse } from '../../index'; import { sleep } from '../../../../../test/utils'; var Panel = Collapse.Panel; describe("Collapse", function () { it("Could be expand and collapse", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { var wrapper; return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: wrapper = mount( /*#__PURE__*/React.createElement(Collapse, null, /*#__PURE__*/React.createElement(Panel, { header: "This is panel header 1", key: "1" }, /*#__PURE__*/React.createElement("p", null, "A dog is a type of domesticated animal.")))); expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(false); wrapper.find('.ant-collapse-header').at(0).simulate('click'); wrapper.update(); _context.next = 6; return sleep(400); case 6: wrapper.update(); expect(wrapper.find('.ant-collapse-item').hasClass('ant-collapse-item-active')).toBe(true); case 8: case "end": return _context.stop(); } }, _callee); }))); it("Up and down arrows", function () { var wrapper = mount( /*#__PURE__*/React.createElement(Collapse, null, /*#__PURE__*/React.createElement(Panel, { header: "This is panel header 1", key: "1" }, /*#__PURE__*/React.createElement("p", null, "A dog is a type of domesticated animal.")))); expect(wrapper.find('svg')).toMatchSnapshot(); }); it("Down and right arrow", function () { var wrapper = mount( /*#__PURE__*/React.createElement(Collapse, { showArrowVertical: false }, /*#__PURE__*/React.createElement(Panel, { header: "This is panel header 1", key: "1" }, /*#__PURE__*/React.createElement("p", null, "A dog is a type of domesticated animal.")))); expect(wrapper.find('svg')).toMatchSnapshot(); }); });