Browse Source

Add test for no-color preview in color input dropdown

panr 6 years ago
parent
commit
d84ca9910a
1 changed files with 13 additions and 0 deletions
  1. 13 0
      packages/ckeditor5-table/tests/ui/colorinputview.js

+ 13 - 0
packages/ckeditor5-table/tests/ui/colorinputview.js

@@ -91,6 +91,19 @@ describe( 'ColorInputView', () => {
 				expect( preview.element.classList.contains( 'ck-dropdown__color-picker-preview' ) ).to.be.true;
 			} );
 
+			it( 'should display no-color preview when color is not set', () => {
+				const preview = view._dropdownView.buttonView.children.first;
+				const noColorPreview = preview.element.firstChild;
+
+				view.value = 'hsl(0, 0, 50%)';
+
+				expect( noColorPreview.classList.contains( 'ck-hidden' ) ).to.be.true;
+
+				view.value = '';
+
+				expect( noColorPreview.classList.contains( 'ck-hidden' ) ).to.be.false;
+			} );
+
 			it( 'should have the color grid', () => {
 				expect( view._dropdownView.panelView.children.last ).to.be.instanceOf( ColorGridView );
 			} );