Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3cea965

Browse files
[test] test for customized classes and id
1 parent 9f9203b commit 3cea965

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

‎packages/react-bootstrap-table2/test/bootstrap-table.test.js‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,50 @@ describe('BootstrapTable', () => {
4646
expect(wrapper.state().data).toEqual(store.data);
4747
});
4848

49-
it('should have table-bordered class as default', () => {
50-
expect(wrapper.find('table.table-bordered').length).toBe(1);
49+
it("should only have classes 'table' and 'table-bordered' as default", () => {
50+
expect(wrapper.find('table').prop('className')).toBe('table table-bordered');
51+
});
52+
53+
it('should not have customized id as default', () => {
54+
expect(wrapper.find('table').prop('id')).toBeUndefined();
55+
});
56+
});
57+
58+
describe('when props.classes was defined', () => {
59+
const classes = 'foo';
60+
61+
beforeEach(() => {
62+
wrapper = shallow(
63+
<BootstrapTable
64+
keyField="id"
65+
columns={ columns }
66+
data={ data }
67+
store={ store }
68+
classes={ classes }
69+
/>);
70+
});
71+
72+
it('should display customized classes correctly', () => {
73+
expect(wrapper.find(`table.${classes}`).length).toBe(1);
74+
});
75+
});
76+
77+
describe('when props.id was defined', () => {
78+
const id = 'foo';
79+
80+
beforeEach(() => {
81+
wrapper = shallow(
82+
<BootstrapTable
83+
keyField="id"
84+
columns={ columns }
85+
data={ data }
86+
store={ store }
87+
id={ id }
88+
/>);
89+
});
90+
91+
it('should display customized id correctly', () => {
92+
expect(wrapper.find(`table#${id}`).length).toBe(1);
5193
});
5294
});
5395

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /