Skip to content

Commit 15ec629

Browse files
committed
add unit tests for show-disabled option
1 parent 0007b62 commit 15ec629

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/unit/LaravelVuePagination.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ describe('LaravelVuePagination', function() {
7272
expect(wrapper.findAll('li').at(0).element.classList).toContain('active');
7373
});
7474

75+
it('shows disabled links', function() {
76+
const wrapper = getComponent(LaravelVuePagination, {
77+
data: exampleData,
78+
showDisabled: true,
79+
});
80+
expect(wrapper.findAll('li').at(0).element.classList).toContain('disabled');
81+
expect(wrapper.findAll('a').at(0).element.tabIndex).toBe(-1);
82+
expect(wrapper.findAll('.disabled').length).toEqual(1);
83+
});
84+
85+
it('does not show disabled links', function() {
86+
const wrapper = getComponent(LaravelVuePagination, {
87+
data: exampleData,
88+
});
89+
expect(wrapper.findAll('li').at(0).element.classList).not.toContain('disabled');
90+
expect(wrapper.findAll('a').at(0).element.tabIndex).toBe(0);
91+
expect(wrapper.findAll('.disabled').length).toEqual(0);
92+
});
93+
7594
it('has correct DOM structure with -1 limit on page 2', function() {
7695
exampleData.current_page = 2;
7796
exampleData.next_page_url = 'http://example.com/page/3';

0 commit comments

Comments
 (0)