-
Notifications
You must be signed in to change notification settings - Fork 12
/
CheckingMode.js
61 lines (49 loc) · 1.8 KB
/
CheckingMode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* @license Copyright (c) 2014-2016, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: a11ychecker,toolbar */
( function() {
'use strict';
bender.require( [ 'Controller', 'Controller/CheckingMode', 'mocking' ], function( Controller, CheckingMode, mocking ) {
bender.test( {
setUp: function() {
this.controller = {
editableDecorator: {
markIssues: mocking.spy(),
removeMarkup: mocking.spy()
}
};
mocking.mockProperty( 'issues.resetFocus', this.controller );
mocking.mockProperty( 'viewerController.viewer.panel.hide', this.controller );
mocking.mockProperty( 'editor.fire', this.controller );
this.mock = new CheckingMode( this.controller );
},
'test init': function() {
var editableDecorator = this.controller.editableDecorator;
if ( CKEDITOR.env.chrome ) {
// A patch needed for chrome workaround introduced in #39.
mocking.mockProperty( 'editor.getSelection', this.controller, mocking.spy( function() {
return {
createBookmarks: mocking.spy()
};
} ) );
}
this.mock.init();
assert.areEqual( 1, editableDecorator.markIssues.callCount,
'editableDecorator.markIssues call count' );
},
'test close': function() {
var editableDecorator = this.controller.editableDecorator;
this.mock.close();
assert.areEqual( 1, editableDecorator.removeMarkup.callCount,
'editableDecorator.removeMarkup call count' );
assert.areEqual( 1, this.controller.viewerController.viewer.panel.hide.callCount,
'viewerController.hide() call count' );
assert.areEqual( 1, this.controller.issues.resetFocus.callCount,
'issues.resetFocus() call count' );
}
} );
} );
} )();