This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(theming): BREAKING: no longer apply md-default-theme class to unn…
…ested themable elements closes #4846 Themable elements no longer have a `.md-default-theme` class applied to them if they are not inside of a directive explicitly setting `md-theme="default"` this helps reduce specificity making it easier to override angular material's default style. At the same time, the rule is applied if `md-theme="default"` so that the (presumably nested) theme can have higher specificity than other themes in the DOM. Fix required: Stylesheets should not target elements using the `md-default-theme` selector. Overrides should happen by targeting non angular-material provided classes. As a quick fix, a `md-theme="default"` at the `ng-app` level will result in the `md-default`theme` class being applied as it was before this fix. Theming related styles now target `md-default-theme` making it harder to override when the class is applied.
- Loading branch information
1 parent
7393782
commit 5eb94a5
Showing
3 changed files
with
28 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
describe('mdCard directive', function() { | ||
|
||
beforeEach(module('material.components.card')); | ||
var $mdThemingMock = function() { $mdThemingMock.called = true; }; | ||
|
||
it('should have the default theme class when the md-theme attribute is not defined', inject(function($compile, $rootScope) { | ||
var card = $compile('<md-card></md-card>')($rootScope.$new()); | ||
$rootScope.$apply(); | ||
expect(card.hasClass('md-default-theme')).toBe(true); | ||
beforeEach(module(function($provide) { | ||
$provide.value('$mdTheming', $mdThemingMock); | ||
})); | ||
|
||
it('should have the correct theme class when the md-theme attribute is defined', inject(function($compile, $rootScope) { | ||
var card = $compile('<md-card md-theme="green"></md-card>')($rootScope.$new()); | ||
$rootScope.$apply(); | ||
expect(card.hasClass('md-green-theme')).toBe(true); | ||
beforeEach(module('material.components.card')); | ||
|
||
it('should be themable', inject(function($compile, $rootScope) { | ||
$compile('<md-card></md-card>')($rootScope.$new()); | ||
expect($mdThemingMock.called).toBe(true); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters