UNPKG

generator-polymer-init-vaadin-elements-app

Version:

Progressive web application template with Polymer App Toolbox and Vaadin Elements

67 lines (56 loc) 1.92 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"> <base href="/"> <title>employee-list</title> <script src="bower_components/web-component-tester/browser.js"></script> <!-- Import the element to test --> <link rel="import" href="src/employee-list.html"> </head> <body> <test-fixture id="basic"> <template> <employee-list></employee-list> </template> </test-fixture> <script> suite('employee-list tests', () => { let home, ajax, grid; setup(() => { home = fixture('basic'); const domRoot = home.shadowRoot; ajax = domRoot.querySelector('iron-ajax'); grid = domRoot.querySelector('vaadin-grid'); }); suite('filters', () => { test('empty initial value', () => { assert.equal(home._filterFirstName, ''); assert.equal(home._filterLastName, ''); }); }); suite('grid', () => { setup(done => { // Wait for the response if necessary if (ajax.lastResponse === undefined) { ajax.addEventListener('response', () => done()); } else { done(); } }); test('has all employees', () => { assert.equal(grid.items.length, home._employees.length); }); test('has filtered employees after filter change', () => { home._filterFirstName = 'Aiden'; const uniqueNamesInGrid = grid.items .filter(item => item.firstName.includes(home._filterFirstName)) .map(item => item.firstName); assert.sameMembers(uniqueNamesInGrid, [home._filterFirstName]); }); }); }); </script> </body> </html>