-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14893 from ckeditor/cf/5436
Feature (ui): Implemented new UI components: `ListItemGroupView`, `TextareaView`, `SpinnerView`, `SearchView` and `AutocompleteView`. Feature (ui): Introduced `HighlightedTextView` component for better search results presentation. Other (ui): Made the `ButtonView` label logic open for extension.
- Loading branch information
Showing
85 changed files
with
6,256 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* global document, Event */ | ||
|
||
import { Locale } from '@ckeditor/ckeditor5-utils'; | ||
import DomWrapperView from '../../src/ui/domwrapperview'; | ||
|
||
describe( 'DomWrapperView', () => { | ||
let domElement, view; | ||
|
||
beforeEach( () => { | ||
domElement = document.createElement( 'div' ); | ||
view = new DomWrapperView( new Locale(), domElement ); | ||
} ); | ||
|
||
afterEach( () => { | ||
view.destroy(); | ||
} ); | ||
|
||
describe( 'constructor()', () => { | ||
it( 'should add CSS class to the element', () => { | ||
expect( domElement.classList.contains( 'ck-button' ) ).to.be.true; | ||
} ); | ||
|
||
it( 'should set #isOn observable property with a CSS class binding', () => { | ||
expect( view.isOn ).to.be.false; | ||
|
||
// TODO: This is actually a bug because the initial state is not set correctly. | ||
expect( domElement.classList.contains( 'ck-on' ) ).to.be.false; | ||
expect( domElement.classList.contains( 'ck-off' ) ).to.be.false; | ||
|
||
view.isOn = true; | ||
expect( domElement.classList.contains( 'ck-on' ) ).to.be.true; | ||
expect( domElement.classList.contains( 'ck-off' ) ).to.be.false; | ||
|
||
view.isOn = false; | ||
expect( domElement.classList.contains( 'ck-on' ) ).to.be.false; | ||
expect( domElement.classList.contains( 'ck-off' ) ).to.be.true; | ||
} ); | ||
|
||
it( 'should fire #execute on DOM element click', () => { | ||
const spy = sinon.spy(); | ||
view.on( 'execute', spy ); | ||
|
||
domElement.dispatchEvent( new Event( 'click' ) ); | ||
|
||
sinon.assert.calledOnce( spy ); | ||
} ); | ||
} ); | ||
|
||
describe( 'render()', () => { | ||
it( 'should assign passed element to #element', () => { | ||
view.render(); | ||
expect( view.element ).to.equal( domElement ); | ||
} ); | ||
} ); | ||
|
||
describe( 'focus()', () => { | ||
it( 'focuses the #domElement', () => { | ||
const spy = sinon.spy( domElement, 'focus' ); | ||
|
||
view.focus(); | ||
|
||
sinon.assert.calledOnce( spy ); | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.