mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
test(ion): fix ion tests
This commit is contained in:
@ -7,39 +7,34 @@ describe('Ion', () => {
|
||||
describe('color', () => {
|
||||
|
||||
it('should set color when it hasnt been set yet', () => {
|
||||
ion._setMode('icon', 'md');
|
||||
ion._setColor('icon', 'primary');
|
||||
expect(hasClass(ion, 'icon-primary')).toEqual(true);
|
||||
expect(className(ion)).toEqual('icon-md icon-md-primary');
|
||||
});
|
||||
|
||||
it('should remove color when it has already been set', () => {
|
||||
ion._setMode('icon', 'md');
|
||||
ion._setColor('icon', 'primary');
|
||||
ion._setColor('icon', null);
|
||||
expect(hasClass(ion, 'icon-primary')).toEqual(false);
|
||||
expect(className(ion)).toEqual('icon-md');
|
||||
});
|
||||
|
||||
it('should update color when it has already been set', () => {
|
||||
ion._setMode('icon', 'md');
|
||||
ion._setColor('icon', 'primary');
|
||||
ion._setColor('icon', 'secondary');
|
||||
expect(hasClass(ion, 'icon-primary')).toEqual(false);
|
||||
expect(hasClass(ion, 'icon-secondary')).toEqual(true);
|
||||
expect(className(ion)).toEqual('icon-md icon-md-secondary');
|
||||
});
|
||||
|
||||
it('should not setElementClass if its the same value', () => {
|
||||
ion._setMode('icon', 'ios');
|
||||
ion._setColor('icon', 'primary');
|
||||
spyOn(ion, 'setElementClass');
|
||||
|
||||
expect(ion.setElementClass).not.toHaveBeenCalled();
|
||||
ion._setColor('icon', 'primary');
|
||||
|
||||
expect(hasClass(ion, 'icon-primary')).toEqual(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('mode', () => {
|
||||
|
||||
it('', () => {
|
||||
|
||||
expect(className(ion)).toEqual('icon-ios icon-ios-primary');
|
||||
});
|
||||
|
||||
});
|
||||
@ -50,8 +45,8 @@ describe('Ion', () => {
|
||||
ion = new Ion(mockConfig(), mockElementRef(), mockRenderer());
|
||||
});
|
||||
|
||||
function hasClass(ion: Ion, className: string) {
|
||||
return ion._elementRef.nativeElement.classList.contains(className);
|
||||
function className(ion: Ion) {
|
||||
return ion._elementRef.nativeElement.className;
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -3,7 +3,6 @@ export { Config } from './config/config';
|
||||
export { IonicModule } from './module';
|
||||
|
||||
export * from './directives';
|
||||
export * from './providers';
|
||||
|
||||
export * from './gestures/drag-gesture';
|
||||
export * from './gestures/gesture';
|
||||
|
@ -31,7 +31,7 @@ import { Translate } from './translation/translate';
|
||||
import { TransitionController } from './transitions/transition-controller';
|
||||
import { UserRoot } from './components/app/app-root';
|
||||
|
||||
)
|
||||
|
||||
/**
|
||||
* Export Providers
|
||||
*/
|
||||
|
Reference in New Issue
Block a user