diff --git a/platform/commonUI/general/src/StyleSheetLoader.js b/platform/commonUI/general/src/StyleSheetLoader.js index 29787e2ee8..7f5cabe7c1 100644 --- a/platform/commonUI/general/src/StyleSheetLoader.js +++ b/platform/commonUI/general/src/StyleSheetLoader.js @@ -37,6 +37,8 @@ define( * @param {object[]} stylesheets stylesheet extension definitions * @param $document Angular's jqLite-wrapped document element * @param {string} activeTheme the theme in use + * @param {string} [assetPath] the directory relative to which + * stylesheets will be found */ function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) { var head = $document.find('head'), @@ -69,6 +71,8 @@ define( stylesheet.theme === activeTheme; } + assetPath = assetPath || "."; + // Add all stylesheets from extensions stylesheets.filter(matchesTheme).forEach(addStyleSheet); } diff --git a/platform/commonUI/general/test/StyleSheetLoaderSpec.js b/platform/commonUI/general/test/StyleSheetLoaderSpec.js index 272ad61bf9..4dfb20e82d 100644 --- a/platform/commonUI/general/test/StyleSheetLoaderSpec.js +++ b/platform/commonUI/general/test/StyleSheetLoaderSpec.js @@ -69,7 +69,7 @@ define( it("adjusts link locations", function () { expect(mockElement.setAttribute) - .toHaveBeenCalledWith('href', "a/b/c/d.css"); + .toHaveBeenCalledWith('href', "./a/b/c/d.css"); }); describe("for themed stylesheets", function () { @@ -95,12 +95,13 @@ define( it("includes matching themes", function () { expect(mockElement.setAttribute) - .toHaveBeenCalledWith('href', "a/b/c/themed.css"); + .toHaveBeenCalledWith('href', "./a/b/c/themed.css"); }); it("excludes mismatching themes", function () { expect(mockElement.setAttribute) - .not.toHaveBeenCalledWith('href', "a/b/c/bad-theme.css"); + .not + .toHaveBeenCalledWith('href', "./a/b/c/bad-theme.css"); }); });