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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Tools/GardeningServer/ui/test/ct-last-updated-tests.html
diff --git a/Tools/GardeningServer/ui/test/ct-last-updated-tests.html b/Tools/GardeningServer/ui/test/ct-last-updated-tests.html
index 80750ab01f3d8be7efe5996e189dbe867088b527..8f56d90d5b0b53f77802d4642063cab0d929336a 100644
--- a/Tools/GardeningServer/ui/test/ct-last-updated-tests.html
+++ b/Tools/GardeningServer/ui/test/ct-last-updated-tests.html
@@ -12,22 +12,48 @@ found in the LICENSE file.
var assert = chai.assert;
describe('ct-last-updated', function() {
- var builder;
+ var lastUpdated;
+
+ describe('Updated 5 minutes ago', function() {
+ beforeEach(function(done) {
+ lastUpdated = document.createElement('ct-last-updated');
+ // Set the date to 5 minutes ago.
+ lastUpdated.date = new Date(Date.now() - (5 * 60 * 1000));
+ requestAnimationFrame(function() { done(); });
+ });
- beforeEach(function(done) {
- builder = document.createElement('ct-last-updated');
- // Set the date to 5 minutes ago.
- builder.date = new Date(Date.now() - (5 * 60 * 1000));
- requestAnimationFrame(function() { done(); });
+ it('should have correct text', function() {
+ var expected = 'Updated 5 min ago @ ' + lastUpdated.date.getHours() + ':' +
+ lastUpdated.date.getMinutes();
+ assert.include(lastUpdated.shadowRoot.innerHTML.trim(), expected);
+ });
});
- describe('default UI', function() {
+ describe('No updated data', function() {
+ beforeEach(function(done) {
+ lastUpdated = document.createElement('ct-last-updated');
+ requestAnimationFrame(function() { done(); });
+ });
+
+ it('no text should be visible', function() {
+ assert.notInclude(lastUpdated.shadowRoot.querySelector('template').innerHTML.trim(), "Updated");
+ });
+ });
+
+ describe('Pad minutes when less than 10', function() {
+ beforeEach(function(done) {
+ lastUpdated = document.createElement('ct-last-updated');
+ // Set the date to 5 minutes ago.
+ lastUpdated.date = Date.create('11:05');
+ requestAnimationFrame(function() { done(); });
+ });
+
it('should have correct text', function() {
- var expected = 'Updated 5 min ago @ ' + builder.date.getHours() + ':' +
- builder.date.getMinutes();
- assert.equal(builder.shadowRoot.innerHTML.trim(), expected);
+ var expected = '11:05';
+ assert.include(lastUpdated.shadowRoot.innerHTML.trim(), expected);
});
});
+
});
})()

Powered by Google App Engine
This is Rietveld 408576698