当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript resource-loader.FileSystemResourceLoader类代码示例

本文整理汇总了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"));
    });
});
开发者ID:NathanWalker,项目名称:nativescript-angular,代码行数:48,代码来源:xhr-paths.ts

示例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"))
 });
开发者ID:leocaseiro,项目名称:nativescript-angular,代码行数:4,代码来源:xhr-paths.ts

示例3:

 assert.throws(() => resourceLoader.resolve("does-not-exist.css"));
开发者ID:NathanWalker,项目名称:nativescript-angular,代码行数:1,代码来源:xhr-paths.ts

示例4: it

 it("resolves non-existing .less file to existing .css file", () => {
     assert.strictEqual(
         "/app/dir/mycomponent.css",
         resourceLoader.resolve("mycomponent.less"));
 });
开发者ID:NathanWalker,项目名称:nativescript-angular,代码行数:5,代码来源:xhr-paths.ts


注:本文中的nativescript-angular/resource-loader.FileSystemResourceLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。