forked from angular/angular
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#39964) This commit adds `ngDevMode` guard to call `_ngModelWarning` only in dev mode (similar to how things work in other parts of Ivy runtime code). The `ngDevMode` flag helps to tree-shake this function from production builds (since it will act as no-op, in dev mode everything will work as it works right now) to decrease production bundle size. PR Close angular#39964
- Loading branch information
Showing
11 changed files
with
112 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/core/test/change_detection/differs/keyvalue_differs_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {KeyValueDiffer, KeyValueDifferFactory, KeyValueDiffers, NgModule} from '@angular/core'; | ||
import {TestBed} from '@angular/core/testing'; | ||
|
||
|
||
describe('KeyValueDiffers', function() { | ||
it('should support .extend in root NgModule', () => { | ||
const DIFFER: KeyValueDiffer<any, any> = {} as any; | ||
const log: string[] = []; | ||
class MyKeyValueDifferFactory implements KeyValueDifferFactory { | ||
supports(objects: any): boolean { | ||
log.push('supports', objects); | ||
return true; | ||
} | ||
create<K, V>(): KeyValueDiffer<K, V> { | ||
log.push('create'); | ||
return DIFFER; | ||
} | ||
} | ||
|
||
|
||
@NgModule({providers: [KeyValueDiffers.extend([new MyKeyValueDifferFactory()])]}) | ||
class MyModule { | ||
} | ||
|
||
TestBed.configureTestingModule({imports: [MyModule]}); | ||
const differs = TestBed.inject(KeyValueDiffers); | ||
const differ = differs.find('VALUE').create(); | ||
expect(differ).toEqual(DIFFER); | ||
expect(log).toEqual(['supports', 'VALUE', 'create']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters