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

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

Issue 728023004: Remove GardeningServer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
(Empty)
1 <!--
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
4 found in the LICENSE file.
5 -->
6
7 <link rel="import" href="../ct-last-updated.html">
8
9 <script>
10 (function() {
11
12 var assert = chai.assert;
13
14 describe('ct-last-updated', function() {
15 var lastUpdated;
16
17 describe('Updated 5 minutes ago', function() {
18 beforeEach(function(done) {
19 lastUpdated = document.createElement('ct-last-updated');
20 // Set the date to 5 minutes ago.
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 @ ' + lastUpdated.date.getHours() + ':' +
27 lastUpdated.date.getMinutes().toString().padLeft(2, '0');
28 assert.include(lastUpdated.shadowRoot.getElementsByTagName('span')[0].inne rHTML.trim(), expected);
29 });
30
31 it('should have a stale class', function() {
32 var expected = 'stale_5minutes';
33 assert.include(lastUpdated.shadowRoot.getElementsByTagName('span')[0].clas sName, expected);
34 });
35 });
36
37 describe('Updated 10 minutes ago', function() {
38 beforeEach(function(done) {
39 lastUpdated = document.createElement('ct-last-updated');
40 // Set the date to 10 minutes ago.
41 lastUpdated.date = new Date(Date.now() - (10 * 60 * 1000));
42 requestAnimationFrame(function() { done(); });
43 });
44
45 it('should have a stale class', function() {
46 var expected = 'stale_10minutes';
47 assert.include(lastUpdated.shadowRoot.getElementsByTagName('span')[0].clas sName, expected);
48 });
49 });
50
51 describe('Updated 20 minutes ago', function() {
52 beforeEach(function(done) {
53 lastUpdated = document.createElement('ct-last-updated');
54 // Set the date to 20 minutes ago.
55 lastUpdated.date = new Date(Date.now() - (20 * 60 * 1000));
56 requestAnimationFrame(function() { done(); });
57 });
58
59 it('should have a stale class', function() {
60 var expected = 'stale_20minutes';
61 assert.include(lastUpdated.shadowRoot.getElementsByTagName('span')[0].clas sName, expected);
62 });
63 });
64
65 describe('No updated data', function() {
66 beforeEach(function(done) {
67 lastUpdated = document.createElement('ct-last-updated');
68 requestAnimationFrame(function() { done(); });
69 });
70
71 it('no text should be visible', function() {
72 assert.notInclude(lastUpdated.shadowRoot.querySelector('template').innerHT ML.trim(), "Updated");
73 });
74 });
75
76 describe('Pad minutes when less than 10', function() {
77 beforeEach(function(done) {
78 lastUpdated = document.createElement('ct-last-updated');
79 lastUpdated.date = Date.create('11:05');
80 requestAnimationFrame(function() { done(); });
81 });
82
83 it('should have correct text', function() {
84 var expected = '11:05';
85 assert.include(lastUpdated.shadowRoot.innerHTML.trim(), expected);
86 });
87 });
88
89 describe('Pad minutes when greater than 10', function() {
90 beforeEach(function(done) {
91 lastUpdated = document.createElement('ct-last-updated');
92 lastUpdated.date = Date.create('11:25');
93 requestAnimationFrame(function() { done(); });
94 });
95
96 it('should have correct text', function() {
97 var expected = '11:25';
98 assert.include(lastUpdated.shadowRoot.innerHTML.trim(), expected);
99 });
100 });
101
102
103 });
104
105 })()
106
107 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698