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

Side by Side Diff: remoting/webapp/base/js/base_event_hook_unittest.js

Issue 1017613002: Migrate Remoting Webapp Unittests to use QUnit 2.0 syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 (function() {
6 6
7 'use strict'; 7 'use strict';
8 8
9 /** @type {base.EventSourceImpl} */ 9 /** @type {base.EventSourceImpl} */
10 var eventSource = null; 10 var eventSource = null;
(...skipping 30 matching lines...) Expand all
41 Listener.prototype.dispose = function() { 41 Listener.prototype.dispose = function() {
42 this.eventHooks_.dispose(); 42 this.eventHooks_.dispose();
43 }; 43 };
44 44
45 function raiseAllEvents() { 45 function raiseAllEvents() {
46 domElement.click(); 46 domElement.click();
47 myChromeEvent.mock$fire(); 47 myChromeEvent.mock$fire();
48 eventSource.raiseEvent('customEvent'); 48 eventSource.raiseEvent('customEvent');
49 } 49 }
50 50
51 module('base.EventHook', { 51 QUnit.module('base.EventHook', {
52 setup: function() { 52 beforeEach: function() {
53 domElement = /** @type {HTMLElement} */ (document.createElement('div')); 53 domElement = /** @type {HTMLElement} */ (document.createElement('div'));
54 eventSource = new base.EventSourceImpl(); 54 eventSource = new base.EventSourceImpl();
55 eventSource.defineEvents(['customEvent']); 55 eventSource.defineEvents(['customEvent']);
56 myChromeEvent = new chromeMocks.Event(); 56 myChromeEvent = new chromeMocks.Event();
57 listener = new Listener(domElement); 57 listener = new Listener(domElement);
58 }, 58 },
59 tearDown: function() { 59 afterEach: function() {
60 domElement = null; 60 domElement = null;
61 eventSource = null; 61 eventSource = null;
62 myChromeEvent = null; 62 myChromeEvent = null;
63 listener = null; 63 listener = null;
64 } 64 }
65 }); 65 });
66 66
67 test('EventHook should hook events when constructed', function() { 67 QUnit.test('EventHook should hook events when constructed', function() {
68 raiseAllEvents(); 68 raiseAllEvents();
69 sinon.assert.calledOnce(listener.onClickEvent); 69 sinon.assert.calledOnce(listener.onClickEvent);
70 sinon.assert.calledOnce(listener.onChromeEvent); 70 sinon.assert.calledOnce(listener.onChromeEvent);
71 sinon.assert.calledOnce(listener.onCustomEvent); 71 sinon.assert.calledOnce(listener.onCustomEvent);
72 listener.dispose(); 72 listener.dispose();
73 }); 73 });
74 74
75 test('EventHook should unhook events when disposed', function() { 75 QUnit.test('EventHook should unhook events when disposed', function() {
76 listener.dispose(); 76 listener.dispose();
77 raiseAllEvents(); 77 raiseAllEvents();
78 sinon.assert.notCalled(listener.onClickEvent); 78 sinon.assert.notCalled(listener.onClickEvent);
79 sinon.assert.notCalled(listener.onChromeEvent); 79 sinon.assert.notCalled(listener.onChromeEvent);
80 sinon.assert.notCalled(listener.onCustomEvent); 80 sinon.assert.notCalled(listener.onCustomEvent);
81 }); 81 });
82 82
83 })(); 83 })();
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/base/js/base_unittest.js » ('j') | remoting/webapp/base/js/base_unittest.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698