@@ -163,7 +163,7 @@ describe('$mdThemingProvider', function() {
163
163
expect ( themingProvider . _PALETTES . extended [ '100' ] ) . toEqual ( testPalette [ '100' ] ) ;
164
164
expect ( themingProvider . _PALETTES . extended [ '50' ] ) . toEqual ( 'newValue' ) ;
165
165
} ) ;
166
- } ) ;
166
+ } ) ;
167
167
168
168
describe ( 'css template parsing' , function ( ) {
169
169
beforeEach ( setup ) ;
@@ -351,11 +351,11 @@ describe('$mdThemeProvider with custom styles', function() {
351
351
$mdThemingProvider . registerStyles ( '/*test*/' ) ;
352
352
$mdThemingProvider . theme ( 'register-custom-styles' ) ;
353
353
} ) ;
354
-
354
+
355
355
// Verify that $MD_THEME_CSS is still set to '/**/' in the test environment.
356
- // Check angular-material-mocks.js for $MD_THEME_CSS latest value if this test starts to fail.
356
+ // Check angular-material-mocks.js for $MD_THEME_CSS latest value if this test starts to fail.
357
357
inject ( function ( $MD_THEME_CSS ) { expect ( $MD_THEME_CSS ) . toBe ( '/**/' ) ; } ) ;
358
-
358
+
359
359
// Find the string '/**//*test*/' in the head tag.
360
360
expect ( document . head . innerHTML ) . toContain ( '/*test*/' ) ;
361
361
} ) ;
@@ -419,6 +419,23 @@ describe('$mdThemeProvider with on-demand generation', function() {
419
419
} ) ;
420
420
} ) ;
421
421
422
+ describe ( '$mdThemeProvider with a theme that ends in a newline' , function ( ) {
423
+ beforeEach ( function ( ) {
424
+ module ( 'material.core' , function ( $provide ) {
425
+ // Note that it should end with a newline
426
+ $provide . constant ( '$MD_THEME_CSS' , "sparkle.md-THEME_NAME-theme { color: '{{primary-color}}' }\n" ) ;
427
+ } ) ;
428
+
429
+ inject ( function ( $mdTheming ) { } ) ;
430
+ } ) ;
431
+
432
+ it ( 'should not add an extra closing bracket if the stylesheet ends with a newline' , function ( ) {
433
+ var style = document . head . querySelector ( 'style[md-theme-style]' ) ;
434
+ expect ( style . innerText ) . not . toContain ( '}}' ) ;
435
+ style . parentNode . removeChild ( style ) ;
436
+ } ) ;
437
+ } ) ;
438
+
422
439
describe ( '$mdThemeProvider with nonce' , function ( ) {
423
440
beforeEach ( function ( ) {
424
441
@@ -593,7 +610,7 @@ describe('md-themable directive', function() {
593
610
$rootScope . themey = 'red' ;
594
611
var el = $compile ( '<div md-theme="{{themey}}"><span md-themable md-theme-watch></span></div>' ) ( $rootScope ) ;
595
612
$rootScope . $apply ( ) ;
596
-
613
+
597
614
expect ( el . children ( ) . hasClass ( 'md-red-theme' ) ) . toBe ( true ) ;
598
615
$rootScope . $apply ( 'themey = "blue"' ) ;
599
616
expect ( el . children ( ) . hasClass ( 'md-blue-theme' ) ) . toBe ( true ) ;
@@ -604,7 +621,7 @@ describe('md-themable directive', function() {
604
621
$rootScope . themey = 'red' ;
605
622
var el = $compile ( '<div md-theme="{{themey}}"><span md-themable></span></div>' ) ( $rootScope ) ;
606
623
$rootScope . $apply ( ) ;
607
-
624
+
608
625
expect ( el . children ( ) . hasClass ( 'md-red-theme' ) ) . toBe ( true ) ;
609
626
$rootScope . $apply ( 'themey = "blue"' ) ;
610
627
expect ( el . children ( ) . hasClass ( 'md-blue-theme' ) ) . toBe ( false ) ;
0 commit comments