make tests work

This commit is contained in:
Rene Haas
2022-10-19 13:30:54 +02:00
parent 9358704476
commit 6329332fc3
20 changed files with 4645 additions and 2974 deletions
+4619 -2755
View File
File diff suppressed because it is too large Load Diff
@@ -1,16 +0,0 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
@@ -1,11 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import type { Routes } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
@@ -1,39 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center" class="content">
<h1>Welcome to {{ title }}!</h1>
<span style="display: block">{{ title }} app is running!</span>
<img
width="300"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
</div>
<h2>Here are some links to help you start:</h2>
<overlay-scrollbars></overlay-scrollbars>
<ul>
<li>
<h2>
<a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a>
</h2>
</li>
<li>
<h2>
<a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a>
</h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>
<router-outlet></router-outlet>
`,
styles: [],
})
export class AppComponent {
title = 'example';
}
@@ -1,13 +0,0 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { OverlayscrollbarsModule } from '~/overlayscrollbars.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AppRoutingModule, OverlayscrollbarsModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
@@ -1,3 +0,0 @@
export const environment = {
production: true,
};
@@ -1,16 +0,0 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false,
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

@@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
@@ -1,13 +0,0 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
@@ -1,52 +0,0 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/** *************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/** *************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/** *************************************************************************************************
* APPLICATION IMPORTS
*/
@@ -1 +0,0 @@
/* You can add global styles to this file, and also import other style files */
@@ -1,15 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts",
]
}
+2 -2
View File
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"ng": "ng",
"example": "ng serve",
"example": "ng serve example",
"build": "ng build",
"test": "ng test"
},
@@ -15,7 +15,7 @@
"devDependencies": {
"@angular-devkit/build-angular": "0.1002.4",
"@angular/animations": "^10.0.0",
"@angular/cli": "~14.2.6",
"@angular/cli": "^10.0.0",
"@angular/common": "^10.0.0",
"@angular/compiler": "^10.0.0",
"@angular/compiler-cli": "^10.0.0",
@@ -1,21 +1,22 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { OverlayscrollbarsNgxComponent } from "~/overlayscrollbars-ngx.component";
import { TestBed } from '@angular/core/testing';
import { OverlayscrollbarsComponent } from '~/overlayscrollbars.component';
import type { ComponentFixture } from '@angular/core/testing';
describe("OverlayscrollbarsNgxComponent", () => {
let component: OverlayscrollbarsNgxComponent;
let fixture: ComponentFixture<OverlayscrollbarsNgxComponent>;
describe('OverlayscrollbarsNgxComponent', () => {
let component: OverlayscrollbarsComponent;
let fixture: ComponentFixture<OverlayscrollbarsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [OverlayscrollbarsNgxComponent],
declarations: [OverlayscrollbarsComponent],
}).compileComponents();
fixture = TestBed.createComponent(OverlayscrollbarsNgxComponent);
fixture = TestBed.createComponent(OverlayscrollbarsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,15 +1,15 @@
import { TestBed } from "@angular/core/testing";
import { OverlayscrollbarsNgxService } from "~/overlayscrollbars-ngx.service";
import { TestBed } from '@angular/core/testing';
import { OverlayscrollbarsService } from '~/overlayscrollbars.service';
describe("OverlayscrollbarsNgxService", () => {
let service: OverlayscrollbarsNgxService;
describe('OverlayscrollbarsNgxService', () => {
let service: OverlayscrollbarsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(OverlayscrollbarsNgxService);
service = TestBed.inject(OverlayscrollbarsService);
});
it("should be created", () => {
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+6 -9
View File
@@ -1,12 +1,12 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import "zone.js";
import "zone.js/testing";
import { getTestBed } from "@angular/core/testing";
import 'zone.js';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from "@angular/platform-browser-dynamic/testing";
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(
@@ -20,12 +20,9 @@ declare const require: {
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
// Then we find all the tests.
const context = require.context("./", true, /\.spec\.ts$/);
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().forEach(context);
+2 -2
View File
@@ -17,9 +17,9 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2020",
"target": "ES2015",
"module": "es2020",
"lib": ["es2020", "dom"]
"lib": ["ES2015", "dom"]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
@@ -3,6 +3,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"skipLibCheck": true,
"types": ["jasmine"]
},
"files": ["test/test.ts"],