blob: d6cd3c270d75fc04f41af277388c6f74928015f5 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/ui/base/info_bar.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
test('instantiate', function() {
var infoBar = document.createElement('tr-ui-b-info-bar');
infoBar.message = 'This is an info';
infoBar.visible = true;
this.addHTMLOutput(infoBar);
});
test('buttons', function() {
var infoBar = document.createElement('tr-ui-b-info-bar');
infoBar.visible = true;
infoBar.message = 'This is an info bar with buttons';
var didClick = false;
var button = infoBar.addButton('More info...', function() {
didClick = true;
});
button.click();
assert.isTrue(didClick);
this.addHTMLOutput(infoBar);
});
test('hiding', function() {
var infoBar = document.createElement('tr-ui-b-info-bar');
infoBar.message = 'This is an info bar';
infoBar.visible = true;
this.addHTMLOutput(infoBar);
assert.equal(getComputedStyle(infoBar)['display'], 'flex');
infoBar.visible = false;
assert.equal(getComputedStyle(infoBar)['display'], 'none');
infoBar.visible = true;
assert.equal(getComputedStyle(infoBar)['display'], 'flex');
});
});
</script>