diff --git a/test/unit/mdc-floating-label/mdc-floating-label-foundation.test.js b/test/unit/mdc-floating-label/mdc-floating-label-foundation.test.js index 361966c5f40..a2f40178b8b 100644 --- a/test/unit/mdc-floating-label/mdc-floating-label-foundation.test.js +++ b/test/unit/mdc-floating-label/mdc-floating-label-foundation.test.js @@ -17,7 +17,7 @@ import {assert} from 'chai'; import td from 'testdouble'; -import {verifyDefaultAdapter} from '../helpers/foundation'; +import {captureHandlers, verifyDefaultAdapter} from '../helpers/foundation'; import {setupFoundationTest} from '../helpers/setup'; import MDCFloatingLabelFoundation from '../../../packages/mdc-floating-label/foundation'; @@ -92,3 +92,11 @@ test('#handleShakeAnimationEnd_ should remove LABEL_SHAKE class', () => { foundation.handleShakeAnimationEnd_(); td.verify(mockAdapter.removeClass(cssClasses.LABEL_SHAKE)); }); + +test(`on animationend removes ${cssClasses.LABEL_SHAKE} class`, () => { + const {foundation, mockAdapter} = setupFoundationTest(MDCFloatingLabelFoundation); + const handlers = captureHandlers(mockAdapter, 'registerInteractionHandler'); + foundation.init(); + handlers.animationend(); + td.verify(mockAdapter.removeClass(cssClasses.LABEL_SHAKE)); +}); diff --git a/test/unit/mdc-floating-label/mdc-floating-label.test.js b/test/unit/mdc-floating-label/mdc-floating-label.test.js index 4103210e79f..a3d0686ef58 100644 --- a/test/unit/mdc-floating-label/mdc-floating-label.test.js +++ b/test/unit/mdc-floating-label/mdc-floating-label.test.js @@ -15,6 +15,7 @@ */ import bel from 'bel'; +import td from 'testdouble'; import {assert} from 'chai'; import {MDCFloatingLabel} from '../../../packages/mdc-floating-label/index'; @@ -35,6 +36,27 @@ function setupTest() { return {root, component}; } +test('#shake calls the foundation shake method', () => { + const {component} = setupTest(); + component.foundation_.shake = td.func(); + component.shake(true); + td.verify(component.foundation_.shake(true), {times: 1}); +}); + +test('#getWidth calls the foundation getWidth method', () => { + const {component} = setupTest(); + component.foundation_.getWidth = td.func(); + component.getWidth(); + td.verify(component.foundation_.getWidth(), {times: 1}); +}); + +test('#float calls the foundation float method', () => { + const {component} = setupTest(); + component.foundation_.float = td.func(); + component.float(true); + td.verify(component.foundation_.float(true), {times: 1}); +}); + test('#adapter.addClass adds a class to the element', () => { const {root, component} = setupTest(); component.getDefaultFoundation().adapter_.addClass('foo');