|
|
@@ -15,6 +15,11 @@ import Model from '../../src/model';
|
|
|
import View from '../../src/view';
|
|
|
import ButtonView from '../../src/button/buttonview';
|
|
|
import ToolbarView from '../../src/toolbar/toolbarview';
|
|
|
+import ListItemView from '../../src/list/listitemview';
|
|
|
+import ListView from '../../src/list/listview';
|
|
|
+import DropdownView from '../../src/dropdown/dropdownview';
|
|
|
+import DropdownPanelView from '../../src/dropdown/dropdownpanelview';
|
|
|
+import SplitButtonView from '../../src/button/splitbuttonview';
|
|
|
|
|
|
import {
|
|
|
addListViewToDropdown,
|
|
|
@@ -28,11 +33,6 @@ import {
|
|
|
enableModelIfOneIsEnabled,
|
|
|
focusDropdownContentsOnArrows
|
|
|
} from '../../src/dropdown/utils';
|
|
|
-import ListItemView from '../../src/list/listitemview';
|
|
|
-
|
|
|
-import ListView from '../../src/list/listview';
|
|
|
-import DropdownView from '../../src/dropdown/dropdownview';
|
|
|
-import DropdownPanelView from '../../src/dropdown/dropdownpanelview';
|
|
|
|
|
|
const assertBinding = utilsTestUtils.assertBinding;
|
|
|
|
|
|
@@ -46,6 +46,10 @@ describe( 'utils', () => {
|
|
|
dropdownView = createDropdownView( model, buttonView, locale );
|
|
|
} );
|
|
|
|
|
|
+ afterEach( () => {
|
|
|
+ dropdownView.element.remove();
|
|
|
+ } );
|
|
|
+
|
|
|
describe( 'focusDropdownContentsOnArrows()', () => {
|
|
|
let panelChildView;
|
|
|
|
|
|
@@ -174,19 +178,51 @@ describe( 'utils', () => {
|
|
|
} );
|
|
|
|
|
|
describe( 'createButtonForDropdown()', () => {
|
|
|
- it( 'accepts locale', () => {
|
|
|
- const buttonView = createButtonForDropdown( model, locale );
|
|
|
+ beforeEach( () => {
|
|
|
+ buttonView = createButtonForDropdown( new Model(), locale );
|
|
|
+ } );
|
|
|
|
|
|
+ it( 'accepts locale', () => {
|
|
|
expect( buttonView.locale ).to.equal( locale );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'returns ButtonView instance', () => {
|
|
|
+ expect( buttonView ).to.be.instanceof( ButtonView );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'delegates "execute" to "select" event', () => {
|
|
|
+ const spy = sinon.spy();
|
|
|
+
|
|
|
+ buttonView.on( 'select', spy );
|
|
|
+
|
|
|
+ buttonView.fire( 'exec' );
|
|
|
+
|
|
|
+ sinon.assert.calledOnce( spy );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
describe( 'createSplitButtonForDropdown()', () => {
|
|
|
- it( 'accepts locale', () => {
|
|
|
- const buttonView = createSplitButtonForDropdown( model, locale );
|
|
|
+ beforeEach( () => {
|
|
|
+ buttonView = createSplitButtonForDropdown( new Model(), locale );
|
|
|
+ } );
|
|
|
|
|
|
+ it( 'accepts locale', () => {
|
|
|
expect( buttonView.locale ).to.equal( locale );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'returns SplitButtonView instance', () => {
|
|
|
+ expect( buttonView ).to.be.instanceof( SplitButtonView );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'binds actionView "execute" to "select" event', () => {
|
|
|
+ const spy = sinon.spy();
|
|
|
+
|
|
|
+ buttonView.on( 'select', spy );
|
|
|
+
|
|
|
+ buttonView.fire( 'exec' );
|
|
|
+
|
|
|
+ sinon.assert.calledOnce( spy );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
describe( 'createDropdownView()', () => {
|
|
|
@@ -292,7 +328,7 @@ describe( 'utils', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'createSplitButtonDropdown()', () => {} );
|
|
|
+ describe( 'createSplitButtonDropdown()', () => { } );
|
|
|
|
|
|
describe( 'createSingleButtonDropdown()', () => {} );
|
|
|
|
|
|
@@ -341,10 +377,6 @@ describe( 'utils', () => {
|
|
|
document.body.appendChild( dropdownView.element );
|
|
|
} );
|
|
|
|
|
|
- afterEach( () => {
|
|
|
- dropdownView.element.remove();
|
|
|
- } );
|
|
|
-
|
|
|
it( 'sets view#locale', () => {
|
|
|
expect( dropdownView.locale ).to.equal( locale );
|
|
|
} );
|
|
|
@@ -427,10 +459,6 @@ describe( 'utils', () => {
|
|
|
document.body.appendChild( dropdownView.element );
|
|
|
} );
|
|
|
|
|
|
- afterEach( () => {
|
|
|
- dropdownView.element.remove();
|
|
|
- } );
|
|
|
-
|
|
|
it( 'sets view#locale', () => {
|
|
|
expect( dropdownView.locale ).to.equal( locale );
|
|
|
} );
|