From 038e26302382acd5ebb5571d847d893c3fdb2957 Mon Sep 17 00:00:00 2001 From: lilia Date: Sun, 8 Nov 2015 00:15:14 -0800 Subject: [PATCH] Fix the build 1. Update chrome version because v40 fails to clear the session store 2. Add message view to test page and fix bad reference to chrome 3. Update the message view template in tests with new timestmap markup // FREEBIE --- Gruntfile.js | 2 +- js/chromium.js | 6 +++++- test/index.html | 11 ++++++----- test/views/message_view_test.js | 8 ++++---- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 80e064dc..ad071b5e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -176,7 +176,7 @@ module.exports = function(grunt) { ], build: process.env.TRAVIS_JOB_ID, browsers: [ - { browserName: 'chrome', version: '40' }, + { browserName: 'chrome', version: '41' }, { platform: 'linux', browserName: 'firefox', version: '34' } ], testname: 'TextSecure-Browser Tests', diff --git a/js/chromium.js b/js/chromium.js index 7a88f472..98001fdc 100644 --- a/js/chromium.js +++ b/js/chromium.js @@ -124,7 +124,11 @@ }, onClosed: function(callback) { // assumes only one front end window - return chrome.app.window.getAll()[0].onClosed.addListener(callback); + if (window.chrome && chrome.app && chrome.app.window) { + return chrome.app.window.getAll()[0].onClosed.addListener(callback); + } else { + window.addEventListener('beforeunload', callback); + } }, drawAttention: function(window_id) { diff --git a/test/index.html b/test/index.html index a85a49d6..2dc499d8 100644 --- a/test/index.html +++ b/test/index.html @@ -31,14 +31,14 @@ @@ -118,6 +118,7 @@ + diff --git a/test/views/message_view_test.js b/test/views/message_view_test.js index 40db1f65..e1d2c400 100644 --- a/test/views/message_view_test.js +++ b/test/views/message_view_test.js @@ -10,7 +10,7 @@ describe('MessageView', function() { body: 'hello world', type: 'outgoing', source: '+14158675309', - received_at: new Date().getTime() + received_at: Date.now() }); it('should display the message text', function() { @@ -26,15 +26,15 @@ describe('MessageView', function() { it('should have a nice timestamp', function() { var view = new Whisper.MessageView({model: message}); - message.set({'sent_at': new Date().getTime() - 5000}); + message.set({'sent_at': Date.now() - 5000}); view.render(); assert.match(view.$el.html(), /seconds ago/); - message.set({'sent_at': new Date().getTime() - 60000}); + message.set({'sent_at': Date.now() - 60000}); view.render(); assert.match(view.$el.html(), /minute ago/); - message.set({'sent_at': new Date().getTime() - 3600000}); + message.set({'sent_at': Date.now() - 3600000}); view.render(); assert.match(view.$el.html(), /hour ago/); });