-
Notifications
You must be signed in to change notification settings - Fork 10
Changed: Use EnterCommand's afterExecute event to alter it's behavior. #29
Changes from 3 commits
6e4e87f
2232d29
96f3ca8
ec99c38
63618e9
d67f4ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,15 @@ const formats = [ | |
]; | ||
|
||
describe( 'HeadingsCommand', () => { | ||
let editor, document, command, root; | ||
let editor, document, command, root, schema; | ||
|
||
beforeEach( () => { | ||
return ModelTestEditor.create() | ||
.then( newEditor => { | ||
editor = newEditor; | ||
document = editor.document; | ||
command = new HeadingsCommand( editor, formats ); | ||
const schema = document.schema; | ||
schema = document.schema; | ||
|
||
for ( let format of formats ) { | ||
schema.registerItem( format.id, '$block' ); | ||
|
@@ -53,6 +53,15 @@ describe( 'HeadingsCommand', () => { | |
expect( command.value ).to.equal( format ); | ||
} ); | ||
} | ||
|
||
it( 'should be equal to defaultFormat if format has not been found', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't it be null? Why is this change needed now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because when you focus selection inside a model element that is not in This is because no option has been found to be displayed in the dropdown. However, as I think of it now, it should probably be done like it is in CKE4. There is "Format" option there whenever you are inside something that is not recognized by I think this is worthy of seperate issue because then we have to ask ourselves what is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, so I'm fine with defaulting to the default format in such a case. But next time please do not squeeze such changes without mentioning them ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sorry, this is just the way I are. |
||
schema.registerItem( 'div', '$block' ); | ||
setData( document, '<div>xyz</div>' ); | ||
const element = root.getChild( 0 ); | ||
document.selection.addRange( Range.createFromParentsAndOffsets( element, 1, element, 1 ) ); | ||
|
||
expect( command.value ).to.equal( command.defaultFormat ); | ||
} ); | ||
} ); | ||
|
||
describe( '_doExecute', () => { | ||
|
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.
Leftover?
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.
Yes, I fixed it.