Skip to content
This repository was archived by the owner on Oct 24, 2018. It is now read-only.

Commit 162b96e

Browse files
Merge pull request #120 from caiquecastro/master
Assert Component use global settings
2 parents dbb6ec3 + 0aaf545 commit 162b96e

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

tests/components/TableComponent.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Vue from 'vue/dist/vue.js';
22
import simulant from 'simulant';
3+
import TableComponent from '../../src/';
34

45
describe('TableComponent', () => {
56
beforeEach(() => {
@@ -177,6 +178,25 @@ describe('TableComponent', () => {
177178
expect(document.body.innerHTML).toMatchSnapshot();
178179
});
179180

181+
it('can display a custom message from global settings for no matching results', async () => {
182+
TableComponent.settings({
183+
filterNoResults: 'There are no matching results',
184+
});
185+
186+
document.body.innerHTML = `
187+
<div id="app">
188+
<table-component
189+
:data="[]">
190+
<table-column show="firstName" label="First name"></table-column>
191+
</table-component>
192+
</div>
193+
`;
194+
195+
await createVm();
196+
197+
expect(document.body.innerHTML).toMatchSnapshot();
198+
});
199+
180200
it('can display a custom placeholder in the filter field', async () => {
181201
document.body.innerHTML = `
182202
<div id="app">

tests/components/__snapshots__/TableComponent.test.js.snap

+47
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,53 @@ exports[`TableComponent can add extra classes to the table, the cells and the he
171171
172172
`;
173173
174+
exports[`TableComponent can display a custom message from global settings for no matching results 1`] = `
175+
176+
<div id="app">
177+
<div class="table-component">
178+
<div class="table-component__filter">
179+
<input type="text"
180+
placeholder="Filter table…"
181+
class="table-component__filter__field"
182+
>
183+
<!---->
184+
</div>
185+
<div class="table-component__table-wrapper">
186+
<table class="table-component__table">
187+
<caption role="alert"
188+
aria-live="polite"
189+
class="table-component__table__caption"
190+
>
191+
Table not sorted
192+
</caption>
193+
<thead class="table-component__table__head">
194+
<tr>
195+
<th role="columnheader"
196+
aria-sort="none"
197+
class="table-component__th table-component__th--sort"
198+
>
199+
First name
200+
</th>
201+
</tr>
202+
</thead>
203+
<tbody class="table-component__table__body">
204+
</tbody>
205+
<tfoot>
206+
</tfoot>
207+
</table>
208+
</div>
209+
<div class="table-component__message">
210+
There are no matching results
211+
</div>
212+
<div style="display: none;">
213+
<!---->
214+
</div>
215+
<!---->
216+
</div>
217+
</div>
218+
219+
`;
220+
174221
exports[`TableComponent can display a custom message when filtering results in no results 1`] = `
175222
176223
<div id="app">

0 commit comments

Comments
 (0)