test(ivy): fix sanitization state leaking issue

Due to sanitization being stored as a temp/global value between
instructions, unit tests randomly failed because one test failed
to clean up its temporary value. This patch fixes this issue.
This commit is contained in:
Matias Niemelä 2019-05-30 13:53:06 -07:00
parent 53c6b78c51
commit 19bbf4bc8e
1 changed files with 5 additions and 1 deletions

View File

@ -11,7 +11,7 @@ import {SecurityContext} from '@angular/core/src/core';
import {getLContext} from '@angular/core/src/render3/context_discovery';
import {DebugNode, LViewDebug, toDebug} from '@angular/core/src/render3/debug';
import {SANITIZER} from '@angular/core/src/render3/interfaces/view';
import {RuntimeStylingMode, runtimeSetStylingMode} from '@angular/core/src/render3/styling_next/state';
import {RuntimeStylingMode, runtimeSetStylingMode, setCurrentStyleSanitizer} from '@angular/core/src/render3/styling_next/state';
import {loadLContextFromNode} from '@angular/core/src/render3/util/discovery_utils';
import {ngDevModeResetPerfCounters as resetStylingCounters} from '@angular/core/src/util/ng_dev_mode';
import {TestBed} from '@angular/core/testing';
@ -712,6 +712,10 @@ describe('new styling integration', () => {
const node = getDebugNode(element) !;
const styles = node.styles !;
expect(styles.values['width']).toEqual('200px-safe');
// this is here so that it won't get picked up accidentally in another test
lView[SANITIZER] = null;
setCurrentStyleSanitizer(null);
});
it('should be able to bind a SafeValue to clip-path', () => {