-
Notifications
You must be signed in to change notification settings - Fork 77
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
T/47 #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test that confirms that editor.setData()
is not used anywhere.
tests/ckeditor.js
Outdated
@@ -104,19 +104,6 @@ describe( 'CKEditor Component', () => { | |||
expect( vm.value ).to.equal( '' ); | |||
} ); | |||
|
|||
it( 'should set the initial data', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should not be removed. We need to be sure that the specified data has been passed to the editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions and mostly code-style concerns.
BTW: The PR title is missing some text.
tests/ckeditor.js
Outdated
it( 'should set the initial data', done => { | ||
const setDataStub = sandbox.stub( MockEditor.prototype, 'setData' ); | ||
const { wrapper } = createComponent( { | ||
it( 'should set the initial data by using innerHTML, not by "setData()"', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing link to the issue.
return createElement( this.tagName ); | ||
return createElement(this.tagName, { | ||
domProps: { | ||
innerHTML: this.value || '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work when tagName
is textarea
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried because setting the value of an input like this works only once (the second one will be ignored). In theory, we do it only once but still, this is not the right way IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also... does this whole innerHTML
thing work when a content with/without entities is passed as a value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've built a sample with tagName
set to textarea
. The editor seems to work properly, no error occurs on init and on destroy.
Suggested merge commit message (convention)
Fix: Changed the way of data initialization. Instead of using
setData()
, the content is set viainnerHTML
. Closes #47.