Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge 5f4e6d3 into a5a7d3e
Browse files Browse the repository at this point in the history
  • Loading branch information
panr committed Apr 3, 2020
2 parents a5a7d3e + 5f4e6d3 commit b04d6c3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lang/contexts.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@
"Center table": "The label used by assistive technologies describing a button that centers the table.",
"Align table to the right": "The label used by assistive technologies describing a button that aligns the table to the right.",
"The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\".": "The localized error string that can be displayed next to color (background, border) fields that have an invalid value",
"The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".": "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value."
"The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".": "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value.",
"Color picker": "The label used by assistive technologies describing a button that opens a color picker, where user can choose a configured color for a certain properties (eg.: background color, color, border-color etc.)."
}
2 changes: 2 additions & 0 deletions src/ui/colorinputview.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export default class ColorInputView extends View {
*/
_createDropdownView() {
const locale = this.locale;
const t = locale.t;
const bind = this.bindTemplate;
const colorGrid = this._createColorGrid( locale );
const dropdown = createDropdown( locale );
Expand Down Expand Up @@ -174,6 +175,7 @@ export default class ColorInputView extends View {
} );

dropdown.buttonView.children.add( colorPreview );
dropdown.buttonView.tooltip = t( 'Color picker' );

dropdown.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
dropdown.panelView.children.add( removeColorButton );
Expand Down
3 changes: 2 additions & 1 deletion src/ui/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ export function fillToolbar( { view, icons, toolbar, labels, propertyName, nameT

button.set( {
label: labels[ name ],
icon: icons[ name ]
icon: icons[ name ],
tooltip: labels[ name ]
} );

button.bind( 'isOn' ).to( view, propertyName, value => {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/colorinputview.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe( 'ColorInputView', () => {
it( 'should be created', () => {
expect( view._dropdownView ).to.be.instanceOf( DropdownView );
expect( view._dropdownView.buttonView.element.classList.contains( 'ck-input-color__button' ) ).to.be.true;
expect( view._dropdownView.buttonView.tooltip ).to.equal( 'Color picker' );
} );

it( 'should bind #isEnabled to the view\'s #isReadOnly', () => {
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,12 @@ describe( 'UI Utils', () => {
expect( toolbar.items.last.icon ).to.equal( icons.third );
} );

it( 'should set button tooltips', () => {
expect( toolbar.items.first.tooltip ).to.equal( labels.first );
expect( toolbar.items.get( 1 ).tooltip ).to.equal( labels.second );
expect( toolbar.items.last.tooltip ).to.equal( labels.third );
} );

it( 'should bind button #isOn to an observable property', () => {
expect( toolbar.items.first.isOn ).to.be.false;
expect( toolbar.items.get( 1 ).isOn ).to.be.false;
Expand Down

0 comments on commit b04d6c3

Please sign in to comment.