OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../ct-last-updated.html"> | 7 <link rel="import" href="../ct-last-updated.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 (function() { | 10 (function() { |
11 | 11 |
12 var expect = chai.expect; | 12 var assert = chai.assert; |
13 | 13 |
14 describe('ct-last-updated', function() { | 14 describe('ct-last-updated', function() { |
15 var builder; | 15 var builder; |
16 | 16 |
17 beforeEach(function(done) { | 17 beforeEach(function(done) { |
18 builder = document.createElement('ct-last-updated'); | 18 builder = document.createElement('ct-last-updated'); |
19 // Set the date to 5 minutes ago. | 19 // Set the date to 5 minutes ago. |
20 builder.date = new Date(Date.now() - (5 * 60 * 1000)); | 20 builder.date = new Date(Date.now() - (5 * 60 * 1000)); |
21 requestAnimationFrame(function() { done(); }); | 21 requestAnimationFrame(function() { done(); }); |
22 }); | 22 }); |
23 | 23 |
24 describe('default UI', function() { | 24 describe('default UI', function() { |
25 it('should have correct text', function() { | 25 it('should have correct text', function() { |
26 var expected = 'Updated 5 min ago @ ' + builder.date.getHours() + ':' + | 26 var expected = 'Updated 5 min ago @ ' + builder.date.getHours() + ':' + |
27 builder.date.getMinutes(); | 27 builder.date.getMinutes(); |
28 expect(builder.shadowRoot.innerHTML.trim()).to.equal(expected); | 28 assert.equal(builder.shadowRoot.innerHTML.trim(), expected); |
29 }); | 29 }); |
30 }); | 30 }); |
31 }); | 31 }); |
32 | 32 |
33 })() | 33 })() |
34 | 34 |
35 </script> | 35 </script> |
OLD | NEW |