Home | History | Annotate | Download | only in base
      1 <!DOCTYPE html>
      2 <!--
      3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
      4 Use of this source code is governed by a BSD-style license that can be
      5 found in the LICENSE file.
      6 -->
      7 <link rel="import" href="/tracing/ui/base/info_bar.html">
      8 <script>
      9 'use strict';
     10 
     11 tr.b.unittest.testSuite(function() {
     12   test('instantiate', function() {
     13     var infoBar = document.createElement('tr-ui-b-info-bar');
     14     infoBar.message = 'This is an info';
     15     infoBar.visible = true;
     16     this.addHTMLOutput(infoBar);
     17   });
     18 
     19   test('buttons', function() {
     20     var infoBar = document.createElement('tr-ui-b-info-bar');
     21     infoBar.visible = true;
     22     infoBar.message = 'This is an info bar with buttons';
     23     var didClick = false;
     24     var button = infoBar.addButton('More info...', function() {
     25       didClick = true;
     26     });
     27     button.click();
     28     assert.isTrue(didClick);
     29     this.addHTMLOutput(infoBar);
     30   });
     31 
     32   test('hiding', function() {
     33     var infoBar = document.createElement('tr-ui-b-info-bar');
     34     infoBar.message = 'This is an info bar';
     35     infoBar.visible = true;
     36     this.addHTMLOutput(infoBar);
     37 
     38     assert.equal(getComputedStyle(infoBar)['display'], 'flex');
     39 
     40     infoBar.visible = false;
     41     assert.equal(getComputedStyle(infoBar)['display'], 'none');
     42 
     43     infoBar.visible = true;
     44     assert.equal(getComputedStyle(infoBar)['display'], 'flex');
     45   });
     46 });
     47 </script>
     48