From 8059159c6669ecb635b9a4d3f474bf04be61c22a Mon Sep 17 00:00:00 2001 From: KyuWoo Choi Date: Tue, 17 Apr 2018 09:22:56 +0900 Subject: [PATCH] fix: bold in toolbar not working (close #143)(#145) --- src/js/ui/toolbarItemFactory.js | 2 +- test/ui/toolbarItemFactory.spec.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/js/ui/toolbarItemFactory.js b/src/js/ui/toolbarItemFactory.js index 30e69d5a51..c7e6520db9 100644 --- a/src/js/ui/toolbarItemFactory.js +++ b/src/js/ui/toolbarItemFactory.js @@ -37,7 +37,7 @@ class ToolbarItemFactory { toolbarItem = new ToolbarButton({ name: 'bold', className: 'tui-bold', - command: 'bold', + command: 'Bold', tooltip: i18n.get('Bold'), state: 'bold' }); diff --git a/test/ui/toolbarItemFactory.spec.js b/test/ui/toolbarItemFactory.spec.js index b786a7a934..b0adf605dc 100644 --- a/test/ui/toolbarItemFactory.spec.js +++ b/test/ui/toolbarItemFactory.spec.js @@ -59,5 +59,24 @@ describe('ToolbarItemFactory', () => { expect(ToolbarItemFactory.create('outdent').getName()).toBe('outdent'); expect(ToolbarItemFactory.create('item').getName()).toBe('item'); }); + + it('should create items of commands/events', () => { + expect(ToolbarItemFactory.create('heading')._event).toBe('openHeadingSelect'); + expect(ToolbarItemFactory.create('bold')._command).toBe('Bold'); + expect(ToolbarItemFactory.create('italic')._command).toBe('Italic'); + expect(ToolbarItemFactory.create('strike')._command).toBe('Strike'); + expect(ToolbarItemFactory.create('hr')._command).toBe('HR'); + expect(ToolbarItemFactory.create('quote')._command).toBe('Blockquote'); + expect(ToolbarItemFactory.create('ul')._command).toBe('UL'); + expect(ToolbarItemFactory.create('ol')._command).toBe('OL'); + expect(ToolbarItemFactory.create('task')._command).toBe('Task'); + expect(ToolbarItemFactory.create('table')._event).toBe('openPopupAddTable'); + expect(ToolbarItemFactory.create('image')._event).toBe('openPopupAddImage'); + expect(ToolbarItemFactory.create('link')._event).toBe('openPopupAddLink'); + expect(ToolbarItemFactory.create('code')._command).toBe('Code'); + expect(ToolbarItemFactory.create('codeblock')._command).toBe('CodeBlock'); + expect(ToolbarItemFactory.create('indent')._command).toBe('Indent'); + expect(ToolbarItemFactory.create('outdent')._command).toBe('Outdent'); + }); }); });