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