Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(theme): prepend # to hex codes enableBrowserColor (#11492)
Browse files Browse the repository at this point in the history
check for leading # and prepend
update enableBrowserColor tests

Fixes #11259
  • Loading branch information
jagmeetb authored and jelbourn committed Nov 6, 2018
1 parent 4d29450 commit 0306ac0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/core/services/theming/theming.js
Expand Up @@ -281,6 +281,7 @@ function ThemingProvider($mdColorPalette, $$mdMetaProvider) {
PALETTES[THEMES[theme].colors[options.palette || 'primary'].name];

var color = angular.isObject(palette[hue]) ? palette[hue].hex : palette[hue];
if (color.substr(0, 1) !== '#') color = '#' + color;

return setBrowserColor(color);
};
Expand Down
6 changes: 3 additions & 3 deletions src/core/services/theming/theming.spec.js
Expand Up @@ -363,7 +363,7 @@ describe('$mdThemingProvider', function() {

it('should use default primary color at the meta tag', function () {
var name = 'theme-color';
var content = themingProvider._PALETTES.testPalette['800'].hex;
var content = '#' + themingProvider._PALETTES.testPalette['800'].hex;

expect(document.getElementsByName(name).length).toBe(0);

Expand All @@ -378,7 +378,7 @@ describe('$mdThemingProvider', function() {

var hue = '200';

var content = themingProvider._PALETTES.testPalette[hue].hex;
var content = '#' + themingProvider._PALETTES.testPalette[hue].hex;

expect(document.getElementsByName(name).length).toBe(0);

Expand All @@ -404,7 +404,7 @@ describe('$mdThemingProvider', function() {
it('should use test theme', function () {
var name = 'theme-color';

var content = themingProvider._PALETTES.testPalette['800'].hex;
var content = '#' + themingProvider._PALETTES.testPalette['800'].hex;

expect(document.getElementsByName(name).length).toBe(0);

Expand Down

0 comments on commit 0306ac0

Please sign in to comment.