Browse Source

Set buttons as toggleable and add unit test checking it.

Mateusz Samsel 6 years ago
parent
commit
3c96aeda2b

+ 2 - 1
packages/ckeditor5-basic-styles/src/bold/boldui.js

@@ -36,7 +36,8 @@ export default class BoldUI extends Plugin {
 				label: t( 'Bold' ),
 				icon: boldIcon,
 				keystroke: 'CTRL+B',
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 2 - 1
packages/ckeditor5-basic-styles/src/code/codeui.js

@@ -37,7 +37,8 @@ export default class CodeUI extends Plugin {
 			view.set( {
 				label: t( 'Code' ),
 				icon: codeIcon,
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 2 - 1
packages/ckeditor5-basic-styles/src/italic/italicui.js

@@ -36,7 +36,8 @@ export default class ItalicUI extends Plugin {
 				label: t( 'Italic' ),
 				icon: italicIcon,
 				keystroke: 'CTRL+I',
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 2 - 1
packages/ckeditor5-basic-styles/src/strikethrough/strikethroughui.js

@@ -36,7 +36,8 @@ export default class StrikethroughUI extends Plugin {
 				label: t( 'Strikethrough' ),
 				icon: strikethroughIcon,
 				keystroke: 'CTRL+SHIFT+X',
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 2 - 1
packages/ckeditor5-basic-styles/src/subscript/subscriptui.js

@@ -35,7 +35,8 @@ export default class SubscriptUI extends Plugin {
 			view.set( {
 				label: t( 'Subscript' ),
 				icon: subscriptIcon,
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 2 - 1
packages/ckeditor5-basic-styles/src/superscript/superscriptui.js

@@ -35,7 +35,8 @@ export default class SuperscriptUI extends Plugin {
 			view.set( {
 				label: t( 'Superscript' ),
 				icon: superscriptIcon,
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 2 - 1
packages/ckeditor5-basic-styles/src/underline/underlineui.js

@@ -36,7 +36,8 @@ export default class UnderlineUI extends Plugin {
 				label: t( 'Underline' ),
 				icon: underlineIcon,
 				keystroke: 'CTRL+U',
-				tooltip: true
+				tooltip: true,
+				isToggleable: true
 			} );
 
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );

+ 1 - 0
packages/ckeditor5-basic-styles/tests/bold/boldui.js

@@ -43,6 +43,7 @@ describe( 'BoldUI', () => {
 		expect( boldView.label ).to.equal( 'Bold' );
 		expect( boldView.icon ).to.match( /<svg / );
 		expect( boldView.keystroke ).to.equal( 'CTRL+B' );
+		expect( boldView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute bold command on model execute event', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/code/codeui.js

@@ -42,6 +42,7 @@ describe( 'CodeUI', () => {
 		expect( codeView.isOn ).to.be.false;
 		expect( codeView.label ).to.equal( 'Code' );
 		expect( codeView.icon ).to.match( /<svg / );
+		expect( codeView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute code command on model execute event', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/italic/italicui.js

@@ -44,6 +44,7 @@ describe( 'ItalicUI', () => {
 		expect( italicView.label ).to.equal( 'Italic' );
 		expect( italicView.icon ).to.match( /<svg / );
 		expect( italicView.keystroke ).to.equal( 'CTRL+I' );
+		expect( italicView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute italic command on model execute event', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/strikethrough/strikethroughui.js

@@ -44,6 +44,7 @@ describe( 'StrikethroughUI', () => {
 		expect( strikeView.label ).to.equal( 'Strikethrough' );
 		expect( strikeView.icon ).to.match( /<svg / );
 		expect( strikeView.keystroke ).to.equal( 'CTRL+SHIFT+X' );
+		expect( strikeView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute strikethrough command on model execute event', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/subscript/subscriptui.js

@@ -42,6 +42,7 @@ describe( 'SubscriptUI', () => {
 		expect( subView.isOn ).to.be.false;
 		expect( subView.label ).to.equal( 'Subscript' );
 		expect( subView.icon ).to.match( /<svg / );
+		expect( subView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute subscript command on model execute event', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/superscript/superscriptui.js

@@ -42,6 +42,7 @@ describe( 'SuperscriptUI', () => {
 		expect( superView.isOn ).to.be.false;
 		expect( superView.label ).to.equal( 'Superscript' );
 		expect( superView.icon ).to.match( /<svg / );
+		expect( superView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute superscript command on model execute event', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/underline/underlineui.js

@@ -44,6 +44,7 @@ describe( 'Underline', () => {
 		expect( underlineView.label ).to.equal( 'Underline' );
 		expect( underlineView.icon ).to.match( /<svg / );
 		expect( underlineView.keystroke ).to.equal( 'CTRL+U' );
+		expect( underlineView.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute underline command on model execute event', () => {