-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: Create utility functions for testing view tree. #3669
Comments
I'm almost finished with the tools but have problem defining final API that will suit all our needs, but still be easy to use. getData()getData( node [, options ] )Returns HTML-like string representing getData( element ); // <a>foobar</a> getData( node, selection [, options ] )Returns HTML-like string representing getData( element, selection ) // <a>{foobar}</a> Options object can include two boolean flags: setData()setData( data )Parses provided data and returns nodes with all parsed elements. setData( 'foobar'); // Returns Text node.
setData( '<a>foobar</a>' ); // Returns Element with text node inside.
setData( '<container:div></container:div>' ); // Returns ContainerElement.
setData( '<a:12></a:12>' ); // Returns AttributeElement that has priority set to `12`.
setData( '<a></a><b></b>' ); // Returns DocumentFragment that contains two nodes. Selection ranges can be included. For example: setData( '<a>{foobar}</a>', selection ); All ranges inside selection will be replaced by ranges that are set inside provided setData( '<a>{foo}{bar}</a>' ), selection, '21' ); All ranges inside selection will be replaces by ranges in desired order (first range placed as second, second as first). Questions
|
I think we need 2 levels of the API. One is set of tools to change Methods you described look like the first level. I am not sure if they should be called
I do not like passing selection as a second argument to set it. We will need
The last parameter should be an options object. It could handle also Then second level of the API works with the
I think that it should be like:
|
I mostly agree with @pjasiun proposals. Just two notes:
|
Fixed in ckeditor/ckeditor5-engine#381. |
This is a part of #3626.
We need to create utility functions that will allow to compare view data and selection to expected value, and set view data and selection to given value.
The text was updated successfully, but these errors were encountered: