Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
80 changes: 80 additions & 0 deletions
80
tests/plugins/pastefromword/_helpers/resetforcefromword.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* exported testScenario */ | ||
|
||
'use strict'; | ||
|
||
// Scenario is a sequence (array) of pasted to be fired. True (1) means paste from word, false (0) means regular paste. | ||
function testScenario( scenario, filterPath ) { | ||
bender.editor = { | ||
config: { | ||
pasteFromWordCleanupFile: filterPath | ||
} | ||
}; | ||
|
||
var stub; | ||
|
||
bender.test( { | ||
tearDown: function() { | ||
if ( stub ) { | ||
stub.restore(); | ||
stub = null; | ||
} | ||
}, | ||
|
||
// #10032 | ||
'test reset forceFromWord': function() { | ||
var editor = this.editor, | ||
pasteHtml = '<p>foo</p>', | ||
i = 0; | ||
|
||
|
||
stub = sinon.stub( editor, 'getClipboardData', function( options, callback ) { | ||
if ( callback ) { | ||
callback( { dataValue: pasteHtml } ); | ||
} | ||
} ); | ||
|
||
editor.once( 'paste', paste, null, null, 999 ); | ||
|
||
firePaste( editor, scenario[ i ] ); | ||
|
||
wait(); | ||
|
||
function paste( evt ) { | ||
resume( function() { | ||
assertPaste( evt.data.dataValue, scenario[ i ], i ); | ||
|
||
if ( i == scenario.length ) { | ||
return; | ||
} | ||
|
||
editor.once( 'paste', paste, null, null, 999 ); | ||
|
||
i++; | ||
|
||
firePaste( editor, scenario[ i ] ); | ||
|
||
wait(); | ||
} ); | ||
} | ||
|
||
function firePaste( editor, fromWord ) { | ||
if ( fromWord ) { | ||
editor.execCommand( 'pastefromword' ); | ||
} else { | ||
editor.fire( 'paste', { dataValue: pasteHtml } ); | ||
} | ||
} | ||
|
||
function assertPaste( value, fromWord, index ) { | ||
var expectedFromWord = 'ok', | ||
expectedNotFromWord = '<p>foo</p>'; | ||
|
||
if ( fromWord ) { | ||
assert.areSame( expectedFromWord, value, 'Paste nr ' + index + ' should be from word.' ); | ||
} else { | ||
assert.areSame( expectedNotFromWord, value, 'Paste nr ' + index + ' should NOT be from word.' ); | ||
} | ||
} | ||
} | ||
} ); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
tests/plugins/pastefromword/resetforcefromwordstartfrompastefromword.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* bender-tags: editor,unit,clipboard */ | ||
/* bender-ckeditor-plugins: pastefromword */ | ||
/* bender-include: _helpers/resetforcefromword.js */ | ||
/* global testScenario */ | ||
|
||
'use strict'; | ||
|
||
testScenario( [ 1, 0, 1, 0, 0 ], '%TEST_DIR%_assets/customfilter.js' ); |
8 changes: 8 additions & 0 deletions
8
tests/plugins/pastefromword/resetforcefromwordstartfromregularpaste.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* bender-tags: editor,unit,clipboard */ | ||
/* bender-ckeditor-plugins: pastefromword */ | ||
/* bender-include: _helpers/resetforcefromword.js */ | ||
/* global testScenario */ | ||
|
||
'use strict'; | ||
|
||
testScenario( [ 0, 1, 0, 1, 1, 0 ], '%TEST_DIR%_assets/customfilter.js' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<head> | ||
<style> | ||
table | ||
{ | ||
table-layout: fixed; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="editor"> | ||
<p>Foo</p> | ||
</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'editor' ); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@bender-tags: 4.4.7, tc | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, image | ||
|
||
1. Click the image button. | ||
|
||
Expected: the dialog's layout is OK: | ||
|
||
* the preview panel should be fully visible, | ||
* the *lock* and *refresh* icons are close (<20px) to the inputs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<head> | ||
<style> | ||
table | ||
{ | ||
table-layout: fixed; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="editor"> | ||
<p>Foo</p> | ||
</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'editor', { | ||
skin: 'kama' | ||
} ); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@bender-tags: 4.4.7, tc | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, image | ||
|
||
1. Click the image button. | ||
|
||
Expected: the dialog's layout is OK: | ||
|
||
* the preview panel should be fully visible, | ||
* the *lock* and *refresh* icons are close (<20px) to the inputs. |