Skip to content

Commit

Permalink
test(ion): fix ion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Sep 14, 2016
1 parent 95bcaca commit f368abe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
25 changes: 10 additions & 15 deletions src/components/app/test/ion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

});
Expand All @@ -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;
}

});
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Translate } from './translation/translate';
import { TransitionController } from './transitions/transition-controller';
import { UserRoot } from './components/app/app-root';

)

/**
* Export Providers
*/
Expand Down

0 comments on commit f368abe

Please sign in to comment.