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
This repository was archived by the owner on Jun 27, 2024. It is now read-only.

Commit dc5b53c

Browse files
Update InteractsWithQueryBuilder.test.js
1 parent 4c12337 commit dc5b53c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

‎__tests__/InteractsWithQueryBuilder.test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,52 @@ describe('InteractsWithQueryBuilder.vue', () => {
8989
);
9090
});
9191

92+
it('it provides helper method for table header cells', () => {
93+
const queryBuilderProps = {
94+
sort: "name",
95+
columns: {
96+
name: { key: "name", enabled: true },
97+
email: { key: "email", enabled: false },
98+
country: { key: "country", enabled: false },
99+
},
100+
};
101+
102+
const component = mount(InteractsWithQueryBuilder, {
103+
propsData: {
104+
queryBuilderProps,
105+
},
106+
107+
render() { }
108+
});
109+
110+
expect(component.vm.sortableHeader('name').sortable).toBeTruthy();
111+
expect(component.vm.staticHeader('name').sortable).toBeFalsy();
112+
113+
expect(component.vm.sortableHeader('name').sort).toEqual('asc');
114+
expect(component.vm.sortableHeader('email').sort).toBeFalsy();
115+
expect(component.vm.sortableHeader('country').sort).toBeFalsy();
116+
});
117+
118+
it('it provides helper method for table header cells to switch to sort order', () => {
119+
const queryBuilderProps = {
120+
sort: "name",
121+
columns: {
122+
name: { key: "name", enabled: true },
123+
},
124+
};
125+
126+
const component = mount(InteractsWithQueryBuilder, {
127+
propsData: {
128+
queryBuilderProps,
129+
},
130+
131+
render() { }
132+
});
133+
134+
component.vm.sortableHeader('name').onSort('name');
135+
expect(component.vm.sortableHeader('name').sort).toEqual('desc');
136+
});
137+
92138
it('it toggles a column without changing the page', () => {
93139
const queryBuilderProps = {
94140
columns: {

0 commit comments

Comments
(0)

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