mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-25 10:03:45 +03:00
chore: fix tests
This commit is contained in:
parent
631dfc17dc
commit
abae4c03c3
|
@ -4,7 +4,7 @@ import {
|
|||
Injectable,
|
||||
ComponentFactory,
|
||||
ComponentRef,
|
||||
ViewContainerRef,
|
||||
ViewContainerRef
|
||||
} from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
|
@ -19,7 +19,6 @@ export class ContentProjector {
|
|||
for (let i=0; i < projectedNodesOrComponents.length; i++) {
|
||||
let nodeOrCompRef = projectedNodesOrComponents[i];
|
||||
if (nodeOrCompRef instanceof ComponentRef) {
|
||||
//nodeOrCompRef.changeDetectorRef.detectChanges();
|
||||
projectedNodes.push(nodeOrCompRef.location.nativeElement);
|
||||
componentRefs.push(nodeOrCompRef);
|
||||
} else {
|
||||
|
@ -29,13 +28,13 @@ export class ContentProjector {
|
|||
|
||||
let parentCompRef = parentView.createComponent(componentFactory, null, contextInjector, [projectedNodes]);
|
||||
|
||||
// using private property to get AppElement instance
|
||||
// using private property to get view instance
|
||||
let viewContainer = (<any>parentView)._view;
|
||||
let viewData = (<any>parentView)._data;
|
||||
viewData.embeddedViews = viewData.embeddedViews || [];
|
||||
for (let i=0; i < componentRefs.length; i++) {
|
||||
let compRef = componentRefs[i];
|
||||
// attach view to viewContainer change detector
|
||||
// attach view to containter change detector
|
||||
viewData.embeddedViews.push((<any>compRef.hostView)._view);
|
||||
(<any>compRef.hostView).attachToViewContainerRef(viewContainer);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { getDOM } from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
/** Gets a child DebugElement by tag name. */
|
||||
export function getChildDebugElement(parent, tagName) {
|
||||
|
@ -20,7 +19,13 @@ export function getChildDebugElementAll(parent, tagName) {
|
|||
|
||||
export function mouseclick( element ) {
|
||||
// create a mouse click event
|
||||
var dispatchedEvent = getDOM().createMouseEvent('click');
|
||||
var dispatchedEvent
|
||||
try {
|
||||
dispatchedEvent = new MouseEvent('click', true);
|
||||
} catch (e) {
|
||||
dispatchedEvent = document.createEvent('MouseEvent');
|
||||
dispatchedEvent.initEvent('click', true, false);
|
||||
}
|
||||
// send click to element
|
||||
getDOM().dispatchEvent(element, dispatchedEvent);
|
||||
element.dispatchEvent(dispatchedEvent);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@ require('../lib/vendor');
|
|||
|
||||
var TestBed = require('@angular/core/testing').TestBed;
|
||||
var ErrorHandler = require('@angular/core').ErrorHandler;
|
||||
var forwardRef = require('@angular/core').forwardRef;
|
||||
var BrowserDynamicTestingModule = require('@angular/platform-browser-dynamic/testing').BrowserDynamicTestingModule;
|
||||
var platformBrowserDynamicTesting = require('@angular/platform-browser-dynamic/testing').platformBrowserDynamicTesting;
|
||||
|
||||
var BrowserAnimationsModule = require('@angular/platform-browser/animations').BrowserAnimationsModule;
|
||||
var SpecManager = require('../lib/utils/spec-manager').SpecManager;
|
||||
var services = require('../lib/services/index');
|
||||
var REDOC_PIPES = require('../lib/utils/pipes').REDOC_PIPES;
|
||||
|
@ -38,6 +39,7 @@ TestBed.initTestEnvironment(
|
|||
|
||||
beforeEach(function() {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [BrowserAnimationsModule],
|
||||
providers: [
|
||||
SpecManager,
|
||||
services.AppStateService,
|
||||
|
@ -51,7 +53,7 @@ beforeEach(function() {
|
|||
services.Marker,
|
||||
services.SearchService,
|
||||
{ provide: sharedComponents.LazyTasksService, useClass: sharedComponents.LazyTasksServiceSync },
|
||||
{ provide: ErrorHandler, useClass: services.CustomErrorHandler },
|
||||
//{ provide: ErrorHandler, useClass: forwardRef(function() {return services.CustomErrorHandler}) },
|
||||
{ provide: services.COMPONENT_PARSER_ALLOWED, useValue: { 'security-definitions': components.SecurityDefinitions }}
|
||||
],
|
||||
declarations: [REDOC_PIPES, REDOC_DIRECTIVES, REDOC_COMMON_DIRECTIVES]
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
"pretty": true,
|
||||
"moduleResolution": "node",
|
||||
"types": [
|
||||
"core-js",
|
||||
"jasmine",
|
||||
"should",
|
||||
"requirejs"
|
||||
"webpack"
|
||||
],
|
||||
"lib": [
|
||||
"DOM", "ES2016", "DOM.Iterable"
|
||||
],
|
||||
"noEmitHelpers": true
|
||||
},
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"linterOptions": {
|
||||
"typeCheck": true
|
||||
},
|
||||
"rulesDirectory": ["node_modules/codelyzer"],
|
||||
"rules": {
|
||||
"class-name": true,
|
||||
|
@ -42,7 +45,6 @@
|
|||
"no-input-rename": true,
|
||||
"no-output-rename": true,
|
||||
"pipe-naming": [true, "camelCase"],
|
||||
"import-destructuring-spacing": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"templates-use-public": true,
|
||||
|
|
Loading…
Reference in New Issue
Block a user