test(ivy): don't runViewEngine
tests for ivy (#27645)
All the tests in `packages/core/test/view/` are specific to the `ViewEngine` and shouldn't run for ivy. This PR introduces a new BUILD.bazel file to run those tests separately. PR Close #27645
This commit is contained in:
parent
b00aeeff37
commit
4df82bdbc1
52
packages/core/test/view/BUILD.bazel
Normal file
52
packages/core/test/view/BUILD.bazel
Normal file
@ -0,0 +1,52 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite")
|
||||
|
||||
ts_library(
|
||||
name = "view_lib",
|
||||
testonly = True,
|
||||
srcs = glob(
|
||||
["**/*.ts"],
|
||||
),
|
||||
deps = [
|
||||
"//packages/core",
|
||||
"//packages/core/testing",
|
||||
"//packages/platform-browser",
|
||||
"//packages/private/testing",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "view_node_only_lib",
|
||||
testonly = True,
|
||||
srcs = glob(["**/*_node_only_spec.ts"]),
|
||||
deps = [
|
||||
":view_lib",
|
||||
"//packages/core",
|
||||
"//packages/core/testing",
|
||||
"//packages/private/testing",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "view",
|
||||
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||
tags = [
|
||||
"no-ivy-aot",
|
||||
],
|
||||
deps = [
|
||||
":view_lib",
|
||||
":view_node_only_lib",
|
||||
"//tools/testing:node",
|
||||
],
|
||||
)
|
||||
|
||||
ts_web_test_suite(
|
||||
name = "view_web",
|
||||
tags = [
|
||||
"no-ivy-aot",
|
||||
],
|
||||
deps = [
|
||||
":view_lib",
|
||||
],
|
||||
)
|
@ -9,7 +9,6 @@
|
||||
import {SecurityContext} from '@angular/core';
|
||||
import {ArgumentType, BindingFlags, NodeCheckFn, NodeFlags, Services, ViewData, ViewFlags, ViewState, asElementData, directiveDef, elementDef, rootRenderNodes} from '@angular/core/src/view/index';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
import {callMostRecentEventListenerHandler, compViewDef, createAndGetRootNodes, createRootView, isBrowser, recordNodeToRemove} from './helper';
|
||||
|
||||
@ -200,8 +199,7 @@ const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener'
|
||||
});
|
||||
|
||||
if (isBrowser()) {
|
||||
fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
|
||||
.it('should support OnPush components', () => {
|
||||
it('should support OnPush components', () => {
|
||||
let compInputValue: any;
|
||||
class AComp {
|
||||
a: any;
|
||||
@ -209,8 +207,7 @@ const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener'
|
||||
|
||||
const update = jasmine.createSpy('updater');
|
||||
|
||||
const addListenerSpy =
|
||||
spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
|
||||
const addListenerSpy = spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
|
||||
|
||||
const {view} = createAndGetRootNodes(compViewDef(
|
||||
[
|
||||
|
@ -11,7 +11,6 @@ import {getDebugContext} from '@angular/core/src/errors';
|
||||
import {BindingFlags, NodeFlags, Services, ViewData, ViewDefinition, asElementData, elementDef} from '@angular/core/src/view/index';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
import {ARG_TYPE_VALUES, callMostRecentEventListenerHandler, checkNodeInlineOrDynamic, compViewDef, createAndGetRootNodes, isBrowser, recordNodeToRemove} from './helper';
|
||||
|
||||
@ -185,8 +184,7 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent
|
||||
return result;
|
||||
}
|
||||
|
||||
fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
|
||||
.it('should listen to DOM events', () => {
|
||||
it('should listen to DOM events', () => {
|
||||
const handleEventSpy = jasmine.createSpy('handleEvent');
|
||||
const removeListenerSpy =
|
||||
spyOn(HTMLElement.prototype, removeEventListener).and.callThrough();
|
||||
@ -253,8 +251,7 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent
|
||||
expect(removeListenerSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
|
||||
.it('should preventDefault only if the handler returns false', () => {
|
||||
it('should preventDefault only if the handler returns false', () => {
|
||||
let eventHandlerResult: any;
|
||||
let preventDefaultSpy: jasmine.Spy = undefined !;
|
||||
|
||||
@ -282,11 +279,9 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent
|
||||
expect(preventDefaultSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
fixmeIvy('FW-665: Discovery util fails with "Unable to find context associated with ..."')
|
||||
.it('should report debug info on event errors', () => {
|
||||
it('should report debug info on event errors', () => {
|
||||
const handleErrorSpy = spyOn(TestBed.get(ErrorHandler), 'handleError');
|
||||
const addListenerSpy =
|
||||
spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
|
||||
const addListenerSpy = spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
|
||||
const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
|
||||
0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
|
||||
() => { throw new Error('Test'); })]));
|
||||
|
@ -13,7 +13,6 @@ import {TestBed, withModule} from '@angular/core/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetRootNodes, compViewDef, compViewDefFactory} from './helper';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
describe(`View Providers`, () => {
|
||||
@ -138,9 +137,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(instance.dep instanceof Dep).toBeTruthy();
|
||||
});
|
||||
|
||||
fixmeIvy(
|
||||
'FW-807: NgModule injector doesn\'t report full search path if a token is not found')
|
||||
.it('should not inject deps from sibling root elements', () => {
|
||||
it('should not inject deps from sibling root elements', () => {
|
||||
const rootElNodes = [
|
||||
elementDef(0, NodeFlags.None, null, null, 1, 'span'),
|
||||
directiveDef(1, NodeFlags.None, null, 0, Dep, []),
|
||||
@ -183,8 +180,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(instance.dep instanceof Dep).toBeTruthy();
|
||||
});
|
||||
|
||||
fixmeIvy('FW-807: NgModule injector don\'t report full search path if a token is not found')
|
||||
.it('should throw for missing dependencies', () => {
|
||||
it('should throw for missing dependencies', () => {
|
||||
expect(() => createAndGetRootNodes(compViewDef([
|
||||
elementDef(0, NodeFlags.None, null, null, 1, 'span'),
|
||||
directiveDef(1, NodeFlags.None, null, 0, SomeService, ['nonExistingDep'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user