blob: a2ccac7b62a8ba313d546838e27fd01c2bcb1ad1 [file] [log] [blame]
<!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">
<script src="test-pre-setup.js"></script>
<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', async () => {
await readyToTest();
let sandbox;
setup(() => {
sandbox = sinon.sandbox.create();
});
teardown(() => { sandbox.restore(); });
function testStatus(expectedStatusClass, statusText, statusesToTest) {
suite(expectedStatusClass, () => {
for (const 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>