/** * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ /* globals Event */ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; import ButtonView from '../../src/button/buttonview'; import IconView from '../../src/icon/iconview'; import TooltipView from '../../src/tooltip/tooltipview'; import View from '../../src/view'; import ViewCollection from '../../src/viewcollection'; import env from '@ckeditor/ckeditor5-utils/src/env'; describe( 'ButtonView', () => { let locale, view; testUtils.createSinonSandbox(); beforeEach( () => { locale = { t() {} }; view = new ButtonView( locale ); view.render(); } ); afterEach( () => { view.destroy(); } ); describe( 'constructor()', () => { it( 'creates view#children collection', () => { expect( view.children ).to.be.instanceOf( ViewCollection ); } ); it( 'creates #tooltipView', () => { expect( view.tooltipView ).to.be.instanceOf( TooltipView ); } ); it( 'creates #labelView', () => { expect( view.labelView ).to.be.instanceOf( View ); expect( view.labelView.element.classList.contains( 'ck' ) ).to.be.true; expect( view.labelView.element.classList.contains( 'ck-button__label' ) ).to.be.true; } ); it( 'creates #keystrokeView', () => { expect( view.keystrokeView ).to.be.instanceOf( View ); } ); it( 'creates #iconView', () => { expect( view.iconView ).to.be.instanceOf( IconView ); } ); } ); describe( '