芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/node_modules/reactstrap/src/__tests__/Col.spec.js
import React from 'react'; import { shallow } from 'enzyme'; import { Col } from '../'; describe('Col', () => { it('should render default .col markup', () => { const wrapper = shallow(
); expect(wrapper.html()).toBe('
'); }); it('should render children', () => { const wrapper = shallow(
Children); expect(wrapper.text()).toBe('Children'); }); it('should pass additional classNames', () => { const wrapper = shallow(
); expect(wrapper.hasClass('extra')).toBe(true); expect(wrapper.hasClass('col')).toBe(true); }); it('should allow custom columns to be defined', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col-4')).toBe(true); expect(wrapper.hasClass('col-jumbo-6')).toBe(true); expect(wrapper.hasClass('col')).toBe(false); }); it('should allow custom columns to be defined with objects', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col-wtf-1')).toBe(true); expect(wrapper.hasClass('order-wtf-2')).toBe(true); expect(wrapper.hasClass('offset-wtf-4')).toBe(true); expect(wrapper.hasClass('col')).toBe(false); }); it('should pass col size specific classes as Strings', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col-sm-6')).toBe(true); expect(wrapper.hasClass('col')).toBe(false); }); it('should pass col size specific classes as Numbers', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col-sm-6')).toBe(true); expect(wrapper.hasClass('col')).toBe(false); }); it('should pass col size as flex with values "auto" or without value', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col')).toBe(false); expect(wrapper.hasClass('col-auto')).toBe(true); expect(wrapper.hasClass('col-sm')).toBe(true); }); it('should pass col size specific classes via Objects', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col-sm-6')).toBe(true); expect(wrapper.hasClass('col')).toBe(false); expect(wrapper.hasClass('order-sm-2')).toBe(true); expect(wrapper.hasClass('offset-sm-2')).toBe(true); }); it('should pass col size specific classes via Objects including 0', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col-sm-6')).toBe(true); expect(wrapper.hasClass('col')).toBe(false); expect(wrapper.hasClass('order-sm-0')).toBe(true); expect(wrapper.hasClass('offset-sm-0')).toBe(true); }); it('should pass col size when passing via object with size "auto"', () => { const wrapper = shallow(
); expect(wrapper.hasClass('col')).toBe(false); expect(wrapper.hasClass('col-sm-auto')).toBe(true); }); it('should render custom tag', () => { const wrapper = shallow(
Yo!); expect(wrapper.text()).toBe('Yo!'); expect(wrapper.type()).toBe('main'); expect(wrapper.hasClass('col')).toBe(true); }); });