Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: Tools/GardeningServer/ui/test/ct-last-updated-tests.html

Issue 466783002: Hide last updated data until date is populated. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 assert = chai.assert; 12 var assert = chai.assert;
13 13
14 describe('ct-last-updated', function() { 14 describe('ct-last-updated', function() {
15 var builder; 15 var lastUpdated;
16 16
17 beforeEach(function(done) { 17 describe('Updated 5 minutes ago', function() {
18 builder = document.createElement('ct-last-updated'); 18 beforeEach(function(done) {
19 // Set the date to 5 minutes ago. 19 lastUpdated = document.createElement('ct-last-updated');
20 builder.date = new Date(Date.now() - (5 * 60 * 1000)); 20 // Set the date to 5 minutes ago.
21 requestAnimationFrame(function() { done(); }); 21 lastUpdated.date = new Date(Date.now() - (5 * 60 * 1000));
22 requestAnimationFrame(function() { done(); });
23 });
24
25 it('should have correct text', function() {
26 var expected = 'Updated 5 min ago @ ' + lastUpdated.date.getHours() + ':' +
27 lastUpdated.date.getMinutes();
28 assert.include(lastUpdated.shadowRoot.innerHTML.trim(), expected);
29 });
22 }); 30 });
23 31
24 describe('default UI', function() { 32 describe('No updated data', function() {
25 it('should have correct text', function() { 33 beforeEach(function(done) {
26 var expected = 'Updated 5 min ago @ ' + builder.date.getHours() + ':' + 34 lastUpdated = document.createElement('ct-last-updated');
27 builder.date.getMinutes(); 35 requestAnimationFrame(function() { done(); });
28 assert.equal(builder.shadowRoot.innerHTML.trim(), expected); 36 });
37
38 it('no text should be visible', function() {
39 assert.notInclude(lastUpdated.shadowRoot.querySelector('template').innerHT ML.trim(), "Updated");
29 }); 40 });
30 }); 41 });
42
43 describe('Pad minutes when less than 10', function() {
44 beforeEach(function(done) {
45 lastUpdated = document.createElement('ct-last-updated');
46 // Set the date to 5 minutes ago.
47 lastUpdated.date = Date.create('11:05');
48 requestAnimationFrame(function() { done(); });
49 });
50
51 it('should have correct text', function() {
52 var expected = '11:05';
53 assert.include(lastUpdated.shadowRoot.innerHTML.trim(), expected);
54 });
55 });
56
31 }); 57 });
32 58
33 })() 59 })()
34 60
35 </script> 61 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698