| <!DOCTYPE html> |
| <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> |
| <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> |
| <script src="/bower_components/web-component-tester/browser.js"></script> |
| |
| <link rel="import" href="/bower_components/polymer/polymer.html"> |
| |
| <title>gr-checks-item</title> |
| <link rel="import" href="gr-checks-status.html"> |
| |
| <test-fixture id="basic"> |
| <template is="dom-template"> |
| <gr-checks-status show-text="{{showText}}" status="{{status}}"></gr-checks-status> |
| </template> |
| </test-fixture> |
| |
| <script> |
| suite('gr-checks-status tests', () => { |
| let element; |
| let sandbox; |
| |
| setup(() => { |
| sandbox = sinon.sandbox.create(); |
| }); |
| |
| teardown(() => { sandbox.restore(); }); |
| |
| function testStatus(expectedStatusClass, statusText, statusesToTest) { |
| suite(expectedStatusClass, () => { |
| |
| for(let statusToTest of statusesToTest) { |
| test(`renders ${expectedStatusClass} for ${statusToTest}`, (done) => { |
| const element = fixture('basic', { |
| status: statusToTest, |
| showText: false, |
| }); |
| |
| flush(() => { |
| const svg = element.$$(`span svg`); |
| assert.exists(svg); |
| done(); |
| }); |
| }); |
| test(`renders ${expectedStatusClass} for ${statusToTest} rendering text ${statusText}`, (done) => { |
| const element = fixture('basic', { |
| status: statusToTest, |
| showText: true, |
| }); |
| |
| flush(() => { |
| const text = element.$$(`span span`); |
| assert.equal(text.textContent.trim(), statusText); |
| done(); |
| }); |
| }); |
| } |
| }); |
| } |
| |
| testStatus('successful', 'Successful', ['SUCCESSFUL']); |
| testStatus('failed', 'Failed', ['FAILED']); |
| testStatus('running', 'Running', ['RUNNING']); |
| testStatus('running', 'Scheduled', ['SCHEDULED']); |
| testStatus('unevaluated', 'Unevaluated', ['NOT_STARTED']); |
| }); |
| </script> |