This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from ckeditor/t/ckeditor5/1151
Tests: Added a manual test for widget selection handler in different UI language directions. See ckeditor/ckeditor5#1151.
- Loading branch information
Showing
3 changed files
with
130 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<head> | ||
<style> | ||
body { | ||
max-width: 800px; | ||
margin: 20px auto; | ||
} | ||
|
||
.ck-content .widget { | ||
background: rgba( 0, 0, 0, 0.1 ); | ||
min-height: 50px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<h2>LTR UI</h2> | ||
|
||
<div id="editor-ltr"> | ||
<h2>Heading 1</h2> | ||
<p>Paragraph</p> | ||
<div class="widget"></div> | ||
<p>Paragraph</p> | ||
</div> | ||
|
||
<h2>RTL UI</h2> | ||
|
||
<div id="editor-rtl"> | ||
<h2>Heading 1</h2> | ||
<p>Paragraph</p> | ||
<div class="widget"></div> | ||
<p>Paragraph</p> | ||
</div> |
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,82 @@ | ||
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* globals console, window, document */ | ||
|
||
import Widget from '../../src/widget'; | ||
import { toWidget } from '../../src/utils'; | ||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset'; | ||
|
||
function MyPlugin( editor ) { | ||
editor.model.schema.register( 'div', { | ||
allowIn: [ '$root' ], | ||
isObject: true | ||
} ); | ||
|
||
editor.conversion.for( 'downcast' ).elementToElement( { | ||
model: 'div', | ||
view: ( modelElement, writer ) => { | ||
return toWidget( writer.createContainerElement( 'div', { | ||
class: 'widget' | ||
} ), | ||
writer, | ||
{ hasSelectionHandler: true } ); | ||
} | ||
} ); | ||
|
||
editor.conversion.for( 'upcast' ).elementToElement( { | ||
model: 'div', | ||
view: 'div' | ||
} ); | ||
} | ||
|
||
const config = { | ||
plugins: [ ArticlePluginSet, Widget, MyPlugin ], | ||
toolbar: [ | ||
'heading', | ||
'|', | ||
'bold', | ||
'italic', | ||
'link', | ||
'bulletedList', | ||
'numberedList', | ||
'blockQuote', | ||
'insertTable', | ||
'mediaEmbed', | ||
'undo', | ||
'redo' | ||
], | ||
image: { | ||
toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ] | ||
}, | ||
table: { | ||
contentToolbar: [ | ||
'tableColumn', | ||
'tableRow', | ||
'mergeTableCells' | ||
] | ||
} | ||
}; | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#editor-ltr' ), config ) | ||
.then( editor => { | ||
window.editorLtr = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#editor-rtl' ), Object.assign( {}, config, { | ||
language: 'ar' | ||
} ) ) | ||
.then( editor => { | ||
window.editorRtl = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); |
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,17 @@ | ||
# Widget selection handler | ||
|
||
**Note**: For the best testing, run manual tests adding Arabic to [additional languages configuration](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/testing-environment.html#running-manual-tests). | ||
|
||
--- | ||
|
||
1. Focus the widget. | ||
1. The outline of the widget and the selection handler should be continuous. | ||
1. The selection handler should be attached to the top of the widget. | ||
|
||
## LTR | ||
|
||
1. The selection handler should be displayed on the **left** side of the widget. | ||
|
||
## RTL | ||
|
||
1. The selection handler should be displayed on the **right** side of the widget. |