diff --git a/platform/commonUI/general/test/StyleSheetLoaderSpec.js b/platform/commonUI/general/test/StyleSheetLoaderSpec.js index b2c1a7da93..8a679004d8 100644 --- a/platform/commonUI/general/test/StyleSheetLoaderSpec.js +++ b/platform/commonUI/general/test/StyleSheetLoaderSpec.js @@ -32,10 +32,11 @@ define( mockPlainDocument, mockHead, mockElement, + testBundle, loader; beforeEach(function () { - var testBundle = { + testBundle = { path: "a/b", resources: "c" }; @@ -72,6 +73,40 @@ define( expect(mockElement.setAttribute) .toHaveBeenCalledWith('href', "a/b/c/d.css"); }); + + describe("for themed stylesheets", function () { + var testTheme = "test-theme"; + + beforeEach(function () { + testStyleSheets = [{ + stylesheetUrl: "themed.css", + bundle: testBundle, + theme: testTheme + }, { + stylesheetUrl: "bad-theme.css", + bundle: testBundle, + theme: 'bad-theme' + }]; + + loader = new StyleSheetLoader( + testStyleSheets, + mockDocument, + testTheme + ); + }) + + it("includes matching themes", function () { + expect(mockElement.setAttribute) + .toHaveBeenCalledWith('href', "a/b/c/themed.css"); + }); + + it("excludes mismatching themes", function () { + expect(mockElement.setAttribute) + .not.toHaveBeenCalledWith('href', "a/b/c/bad-theme.css"); + }); + }); + + }); } );