From 4f9717331d6a47c7d509b0458877ffd1382fa799 Mon Sep 17 00:00:00 2001 From: Keen Yee Liau Date: Mon, 23 Mar 2020 17:33:39 -0700 Subject: [PATCH] test(common): Add test for NgForOfContext.count (#36046) `NgForOfContext.count` is the length of the iterable. PR Close #36046 --- packages/common/test/directives/ng_for_spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/common/test/directives/ng_for_spec.ts b/packages/common/test/directives/ng_for_spec.ts index 0935650f7e..fef7e67976 100644 --- a/packages/common/test/directives/ng_for_spec.ts +++ b/packages/common/test/directives/ng_for_spec.ts @@ -203,6 +203,17 @@ let thisArg: any; detectChangesAndExpectText('0123456789'); })); + it('should display count correctly', async(() => { + const template = '{{len}}'; + fixture = createTestComponent(template); + + getComponent().items = [0, 1, 2]; + detectChangesAndExpectText('333'); + + getComponent().items = [4, 3, 2, 1, 0, -1]; + detectChangesAndExpectText('666666'); + })); + it('should display first item correctly', async(() => { const template = '{{isFirst.toString()}}';