本文整理汇总了TypeScript中nativescript-angular/resource-loader.FileSystemResourceLoader类的典型用法代码示例。如果您正苦于以下问题:TypeScript FileSystemResourceLoader类的具体用法?TypeScript FileSystemResourceLoader怎么用?TypeScript FileSystemResourceLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSystemResourceLoader类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe("XHR name resolution", () => {
let resourceLoader: FileSystemResourceLoader;
before(() => {
resourceLoader = new FileSystemResourceLoader(new NSFileSystemMock());
});
it("resolves relative paths from app root", () => {
assert.strictEqual("/app/dir/mydir/mycomponent.html", resourceLoader.resolve("mydir/mycomponent.html"));
});
it("resolves double-slashed absolute paths as is", () => {
assert.strictEqual("//app/mydir/mycomponent.html", resourceLoader.resolve("//app/mydir/mycomponent.html"));
});
it("resolves single-slashed absolute paths as is", () => {
assert.strictEqual(
"/data/data/app/mydir/mycomponent.html",
resourceLoader.resolve("/data/data/app/mydir/mycomponent.html"));
});
it("resolves existing CSS file", () => {
assert.strictEqual(
"/app/dir/mycomponent.css",
resourceLoader.resolve("mycomponent.css"));
});
it("resolves non-existing .scss file to existing .css file", () => {
assert.strictEqual(
"/app/dir/mycomponent.css",
resourceLoader.resolve("mycomponent.scss"));
});
it("resolves non-existing .sass file to existing .css file", () => {
assert.strictEqual(
"/app/dir/mycomponent.css",
resourceLoader.resolve("mycomponent.sass"));
});
it("resolves non-existing .less file to existing .css file", () => {
assert.strictEqual(
"/app/dir/mycomponent.css",
resourceLoader.resolve("mycomponent.less"));
});
it("throws for non-existing file that has no fallbacks", () => {
assert.throws(() => resourceLoader.resolve("does-not-exist.css"));
});
});
示例2: it
it("resolves relative paths from app root", () => {
const xhr = new FileSystemResourceLoader();
assert.strictEqual("/app/dir/mydir/mycomponent.html", xhr.resolve("mydir/mycomponent.html", "/app/dir"))
});
示例3:
assert.throws(() => resourceLoader.resolve("does-not-exist.css"));
示例4: it
it("resolves non-existing .less file to existing .css file", () => {
assert.strictEqual(
"/app/dir/mycomponent.css",
resourceLoader.resolve("mycomponent.less"));
});