• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript angular.IFilterService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中angular.IFilterService的典型用法代码示例。如果您正苦于以下问题:TypeScript IFilterService类的具体用法?TypeScript IFilterService怎么用?TypeScript IFilterService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IFilterService类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: describe

describe("downloadsCategory", () => {
    let filter, $filter: IFilterService;

    beforeEach(() => angular.mock.module(DOWNLOADS_MODULE));

    beforeEach(angular.mock.inject($injector => {
        $filter = $injector.get("$filter");

        filter = $filter("downloadsCategory");
    }));

    describe("downloads category filter functionality", () => {
        const downloads = [
            {CADownloadsID: 1, Category: "A"},
            {CADownloadsID: 2, Category: "A"},
            {CADownloadsID: 3, Category: "A"},
            {CADownloadsID: 4, Category: "C"},
            {CADownloadsID: 5, Category: "D"},
            {CADownloadsID: 6, Category: "F"}
        ];

        it("should filter on weekdays", () => {
            const categoryIncludes: Array<string> = ["A", "F"];
            expect(filter(downloads, categoryIncludes)).toEqual([
                {CADownloadsID: 1, Category: "A"},
                {CADownloadsID: 2, Category: "A"},
                {CADownloadsID: 3, Category: "A"},
                {CADownloadsID: 6, Category: "F"}
            ]);
        });
    });
});
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:32,代码来源:downloads-category.filter.spec.ts


示例2: describe

describe("literatureOrderStatus", () => {
    let filter, $filter: IFilterService;

    beforeEach(() => angular.mock.module(LITERATURE_MODULE));

    beforeEach(angular.mock.inject($injector => {
        $filter = $injector.get("$filter");

        filter = $filter("literatureOrderStatus");
    }));

    describe("status filter functionality", () => {
        const litOrderList = [
            {LitOrdersID: 1, OrderStatus: "Cancelled"},
            {LitOrdersID: 2, OrderStatus: "Draft"},
            {LitOrdersID: 3, OrderStatus: "Submitted"},
            {LitOrdersID: 4, OrderStatus: "Completed"},
            {LitOrdersID: 5, OrderStatus: "Completed"},
            {LitOrdersID: 6, OrderStatus: "Completed"}
        ];

        it("should filter correct items", () => {
            const checkModel = {
                Draft: true,
                Submitted: true,
                Completed: false,
                Cancelled: false
            };
            expect(filter(litOrderList, checkModel)).toEqual( [
                {LitOrdersID: 2, OrderStatus: "Draft"},
                {LitOrdersID: 3, OrderStatus: "Submitted"}
            ]);
        });

        it("should filter correct items", () => {
            const checkModel = {
                Draft: false,
                Submitted: false,
                Completed: true,
                Cancelled: false
            };
            expect(filter(litOrderList, checkModel)).toEqual( [
                {LitOrdersID: 4, OrderStatus: "Completed"},
                {LitOrdersID: 5, OrderStatus: "Completed"},
                {LitOrdersID: 6, OrderStatus: "Completed"}
            ]);
        });

        it("should be empty if all are false", () => {
            const checkModel = {
                Draft: false,
                Submitted: false,
                Completed: false,
                Cancelled: false
            };
            expect(filter(litOrderList, checkModel)).toEqual([]);
        });
    });
});
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:59,代码来源:literature-order-status.filter.spec.ts


示例3: describe

describe("district filter", () => {
    let filter, $filter: IFilterService;
    let testMeetings: Array<IMeeting>, areaDistrictCheckModel: Array<IDistrict>;

    beforeEach(() => angular.mock.module(MEETINGS_MODULE));

    beforeEach(angular.mock.inject($injector => {
        $filter = $injector.get("$filter");

        filter = $filter("district");

        testMeetings = [];

        for (let i: number = 0; i < 6; i++) {
            testMeetings.push(_.clone(TestMeetings[0]));
        }

        testMeetings[0].Area = "CENTRAL";
        testMeetings[0].District = "UNKNOWN";
        testMeetings[1].Area = "CENTRAL";
        testMeetings[1].District = "UNKNOWN";
        testMeetings[2].Area = "LONDON";
        testMeetings[2].District = "NONE";
        testMeetings[3].Area = "UK";
        testMeetings[3].District = "ESSEX";
        testMeetings[4].Area = "UK";
        testMeetings[4].District = "ESSEX";
        testMeetings[5].Area = "CENTRAL";
        testMeetings[5].District = "UNKNOWN";

        areaDistrictCheckModel = _.clone(TestDistricts);
        _.forEach(areaDistrictCheckModel, ad => ad.Truthy = true);
    }));

    it("should filter on selected districts when all selected", () => {
        const result: Array<IMeeting> = filter(testMeetings, areaDistrictCheckModel);
        expect(result.length).toEqual(6);
    });

    it("should filter on selected districts when some selected", () => {
        areaDistrictCheckModel[2].Truthy = false;

        const result: Array<IMeeting> = filter(testMeetings, areaDistrictCheckModel);
        expect(result.length).toEqual(4);
    });

    it("should filter on selected districts when none selected", () => {
        areaDistrictCheckModel[0].Truthy = false;
        areaDistrictCheckModel[1].Truthy = false;
        areaDistrictCheckModel[2].Truthy = false;

        const result: Array<IMeeting> = filter(testMeetings, areaDistrictCheckModel);
        expect(result.length).toEqual(0);
    });
});
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:55,代码来源:district.filter.spec.ts


示例4: function

 function($filter: IFilterService) {
   filter = $filter('duration') as any;
 }
开发者ID:jcwest,项目名称:deck,代码行数:3,代码来源:timeFormatters.spec.ts


示例5:

 mock.inject(function($filter: IFilterService) {
   filter = $filter('duration') as any;
 }),
开发者ID:mizzy,项目名称:deck,代码行数:3,代码来源:timeFormatters.spec.ts


示例6: beforeEach

    beforeEach(angular.mock.inject($injector => {
        $filter = $injector.get("$filter");

        filter = $filter("district");

        testMeetings = [];

        for (let i: number = 0; i < 6; i++) {
            testMeetings.push(_.clone(TestMeetings[0]));
        }

        testMeetings[0].Area = "CENTRAL";
        testMeetings[0].District = "UNKNOWN";
        testMeetings[1].Area = "CENTRAL";
        testMeetings[1].District = "UNKNOWN";
        testMeetings[2].Area = "LONDON";
        testMeetings[2].District = "NONE";
        testMeetings[3].Area = "UK";
        testMeetings[3].District = "ESSEX";
        testMeetings[4].Area = "UK";
        testMeetings[4].District = "ESSEX";
        testMeetings[5].Area = "CENTRAL";
        testMeetings[5].District = "UNKNOWN";

        areaDistrictCheckModel = _.clone(TestDistricts);
        _.forEach(areaDistrictCheckModel, ad => ad.Truthy = true);
    }));
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:27,代码来源:district.filter.spec.ts


示例7: beforeEach

    beforeEach(angular.mock.inject($injector => {
        $filter = $injector.get("$filter");

        filter = $filter("downloadsCategory");
    }));
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:5,代码来源:downloads-category.filter.spec.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript angular.IHttpBackendService类代码示例发布时间:2022-05-28
下一篇:
TypeScript angular.IDocumentService类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap