Skip to content

Commit

Permalink
fix(js-theme): fix defaut font, fix e2e & unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nnixaa committed Oct 16, 2017
1 parent 782b8df commit cff8561
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
10 changes: 8 additions & 2 deletions src/framework/theme/services/breakpoints.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('breakpoint-service', () => {
},
)));

const total = 7;
const total = 8;
it(`has ${total} default breakpoints`, () => {
expect(breakpointService.getBreakpoints().length).toEqual(total);
});
Expand All @@ -45,7 +45,13 @@ describe('breakpoint-service', () => {

it(`has correct xs breakpoint`, () => {
expect(breakpointService.getByWidth(0).name).toEqual('xs');
expect(breakpointService.getByWidth(575).name).toEqual('xs');
expect(breakpointService.getByWidth(399).name).toEqual('xs');
});

it(`has correct is breakpoint`, () => {
expect(breakpointService.getByWidth(400).name).toEqual('is');
expect(breakpointService.getByWidth(490).name).toEqual('is');
expect(breakpointService.getByWidth(575).name).toEqual('is');
});

it(`has correct sm breakpoint`, () => {
Expand Down
6 changes: 4 additions & 2 deletions src/framework/theme/services/js-themes-registry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ describe('js-themes-registry-service', () => {
});

it('has built in themes with inherited font', () => {
expect(jsThemesRegistry.get('default').variables.fontMain).toEqual('Helvetica');
expect(jsThemesRegistry.get('cosmic').variables.fontMain).toEqual('Helvetica');
expect(jsThemesRegistry.get('default').variables.fontMain)
.toEqual('"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif');
expect(jsThemesRegistry.get('cosmic').variables.fontMain)
.toEqual('"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif');
});

it('has also new themes', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/framework/theme/services/js-themes/default.theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const palette = {
export const DEFAULT_THEME: NbJSThemeOptions = {
name: 'default',
variables: {
fontMain: 'Helvetica',
fontSecondary: 'Helvetica',
fontMain: '"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
fontSecondary: '"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',

bg: '#ffffff',
fg: '#a4abb3',
Expand Down
8 changes: 4 additions & 4 deletions src/framework/theme/services/theme.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ describe('theme-service', () => {

const subscription = themeService.getJsTheme()
.subscribe((change: any) => {
current = change;
current = change.variables;
});
try {
expect(current).not.toBeUndefined();
expect(current.fontMain).toEqual('Open Sans');
expect(current.colorBg).toEqual('#3d3780');
expect(current.fontMain).toEqual('"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif');
expect(current.bg).toEqual('#ffffff');

themeService.changeTheme('cosmic');

expect(current.colorBg).toEqual('#3d3780');
expect(current.bg).toEqual('#3d3780');

} finally {
subscription.unsubscribe();
Expand Down

0 comments on commit cff8561

Please sign in to comment.