mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[API] Update StyleSheetLoaderSpec
...to reflect asset path details
This commit is contained in:
parent
230230aa94
commit
34e07b938d
@ -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);
|
||||
}
|
||||
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user