Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ivy): support
className
in micro benchmarks (#33392)
The styling algorithm requires that the `RNode` has a `className` property in order to execute the fast-path. This changes adds the emulation of this property. PR Close #33392
- Loading branch information
1 parent
b381497
commit 6323a35
Showing
5 changed files
with
101 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. 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 {ProceduralRenderer3} from '@angular/core/src/render3/interfaces/renderer'; | ||
|
||
import {MicroBenchmarkRenderNode, MicroBenchmarkRendererFactory} from './noop_renderer'; | ||
|
||
describe('MicroBenchmarkRenderNode', () => { | ||
const renderer = | ||
new MicroBenchmarkRendererFactory().createRenderer(null, null) as ProceduralRenderer3; | ||
describe('className', () => { | ||
it('should be available in global space', () => { | ||
expect(Node).toBeDefined(); | ||
const node: any = new MicroBenchmarkRenderNode(); | ||
expect(node instanceof Node).toBeTruthy(); | ||
}); | ||
|
||
it('should emulate className', () => { | ||
const node: any = new MicroBenchmarkRenderNode(); | ||
expect(node.className).toBe(''); | ||
renderer.setAttribute(node, 'foo', 'A AA BBB'); | ||
expect(node.className).toBe(''); | ||
renderer.setAttribute(node, 'class', 'A AA BBB'); | ||
expect(node.className).toBe('A AA BBB'); | ||
renderer.addClass(node, 'A'); | ||
expect(node.className).toBe('AA BBB A'); | ||
renderer.addClass(node, 'C'); | ||
expect(node.className).toBe('AA BBB A C'); | ||
renderer.removeClass(node, 'A'); | ||
expect(node.className).toBe('AA BBB C'); | ||
}); | ||
}); | ||
}); |
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