Skip to content

Commit

Permalink
Merge pull request #553 from ckeditor/i/6553
Browse files Browse the repository at this point in the history
Internal: Replaced the `.ck-labeled-input` class with `.ck-labeled-field-view` (see #6553).
  • Loading branch information
oleq authored Apr 8, 2020
2 parents be7997c + b21eed4 commit 1f3ddf5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions packages/ckeditor5-ui/src/labeledfield/labeledfieldview.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export default class LabeledFieldView extends View {
constructor( locale, viewCreator ) {
super( locale );

const viewUid = `ck-labeled-view-${ uid() }`;
const statusUid = `ck-labeled-view-status-${ uid() }`;
const viewUid = `ck-labeled-field-view-${ uid() }`;
const statusUid = `ck-labeled-field-view-status-${ uid() }`;

/**
* The field view that gets labeled.
Expand Down Expand Up @@ -168,7 +168,7 @@ export default class LabeledFieldView extends View {
attributes: {
class: [
'ck',
'ck-labeled-view',
'ck-labeled-field-view',
bind.to( 'class' ),
bind.if( 'isEnabled', 'ck-disabled', value => !value )
]
Expand Down Expand Up @@ -215,8 +215,8 @@ export default class LabeledFieldView extends View {
attributes: {
class: [
'ck',
'ck-labeled-view__status',
bind.if( 'errorText', 'ck-labeled-view__status_error' ),
'ck-labeled-field-view__status',
bind.if( 'errorText', 'ck-labeled-field-view__status_error' ),
bind.if( '_statusText', 'ck-hidden', value => !value )
],
id: statusUid,
Expand Down
12 changes: 6 additions & 6 deletions packages/ckeditor5-ui/tests/labeledfield/labeledfieldview.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe( 'LabeledFieldView', () => {

expect( labeledInput.statusView.element.tagName ).to.equal( 'DIV' );
expect( labeledInput.statusView.element.classList.contains( 'ck' ) ).to.be.true;
expect( labeledInput.statusView.element.classList.contains( 'ck-labeled-view__status' ) ).to.be.true;
expect( labeledInput.statusView.element.classList.contains( 'ck-labeled-field-view__status' ) ).to.be.true;
} );

it( 'should allow pairing #view and #labelView by unique id', () => {
Expand All @@ -83,7 +83,7 @@ describe( 'LabeledFieldView', () => {
describe( 'template', () => {
it( 'should have the CSS class', () => {
expect( labeledInput.element.classList.contains( 'ck' ) ).to.be.true;
expect( labeledInput.element.classList.contains( 'ck-labeled-view' ) ).to.be.true;
expect( labeledInput.element.classList.contains( 'ck-labeled-field-view' ) ).to.be.true;
} );

it( 'should have #labeledInput', () => {
Expand Down Expand Up @@ -116,13 +116,13 @@ describe( 'LabeledFieldView', () => {

labeledInput.errorText = '';
expect( statusElement.classList.contains( 'ck-hidden' ) ).to.be.true;
expect( statusElement.classList.contains( 'ck-labeled-view__status_error' ) ).to.be.false;
expect( statusElement.classList.contains( 'ck-labeled-field-view__status_error' ) ).to.be.false;
expect( statusElement.hasAttribute( 'role' ) ).to.be.false;
expect( statusElement.innerHTML ).to.equal( '' );

labeledInput.errorText = 'foo';
expect( statusElement.classList.contains( 'ck-hidden' ) ).to.be.false;
expect( statusElement.classList.contains( 'ck-labeled-view__status_error' ) ).to.be.true;
expect( statusElement.classList.contains( 'ck-labeled-field-view__status_error' ) ).to.be.true;
expect( statusElement.getAttribute( 'role' ) ).to.equal( 'alert' );
expect( statusElement.innerHTML ).to.equal( 'foo' );
} );
Expand All @@ -132,13 +132,13 @@ describe( 'LabeledFieldView', () => {

labeledInput.infoText = '';
expect( statusElement.classList.contains( 'ck-hidden' ) ).to.be.true;
expect( statusElement.classList.contains( 'ck-labeled-view__status_error' ) ).to.be.false;
expect( statusElement.classList.contains( 'ck-labeled-field-view__status_error' ) ).to.be.false;
expect( statusElement.hasAttribute( 'role' ) ).to.be.false;
expect( statusElement.innerHTML ).to.equal( '' );

labeledInput.infoText = 'foo';
expect( statusElement.classList.contains( 'ck-hidden' ) ).to.be.false;
expect( statusElement.classList.contains( 'ck-labeled-view__status_error' ) ).to.be.false;
expect( statusElement.classList.contains( 'ck-labeled-field-view__status_error' ) ).to.be.false;
expect( statusElement.hasAttribute( 'role' ) ).to.be.false;
expect( statusElement.innerHTML ).to.equal( 'foo' );
} );
Expand Down

0 comments on commit 1f3ddf5

Please sign in to comment.