Skip to content

Commit 589aa92

Browse files
committed
test(typescript): add ts_project angular test
1 parent 1ea655e commit 589aa92

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
2+
load("//packages/typescript:index.bzl", "ts_project")
3+
4+
ts_project(
5+
name = "angular_plugin",
6+
srcs = glob(["*.ts"]) + ["comp.ng.html"],
7+
extends = "//packages/typescript/test/ts_project:tsconfig-base.json",
8+
tsc = "@npm//@angular/compiler-cli/bin:ngc",
9+
tsconfig = ":tsconfig.json",
10+
deps = [
11+
"@npm//@angular/core",
12+
],
13+
)
14+
15+
generated_file_test(
16+
name = "test",
17+
src = "component.js_",
18+
generated = ":angular_plugin",
19+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>{{thing}}</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Component } from '@angular/core';
2+
import * as i0 from "@angular/core";
3+
export class Comp {
4+
constructor() {
5+
this.thing = '';
6+
}
7+
}
8+
Comp.ɵfac = function Comp_Factory(t) { return new (t || Comp)(); };
9+
Comp.ɵcmp = i0.ɵɵdefineComponent({ type: Comp, selectors: [["ng-component"]], decls: 2, vars: 1, template: function Comp_Template(rf, ctx) { if (rf & 1) {
10+
i0.ɵɵelementStart(0, "div");
11+
i0.ɵɵtext(1);
12+
i0.ɵɵelementEnd();
13+
} if (rf & 2) {
14+
i0.ɵɵadvance(1);
15+
i0.ɵɵtextInterpolate(ctx.thing);
16+
} }, encapsulation: 2 });
17+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Comp, [{
18+
type: Component,
19+
args: [{
20+
templateUrl: './comp.ng.html',
21+
}]
22+
}], null, null); })();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Component} from '@angular/core';
2+
3+
@Component({
4+
templateUrl: './comp.ng.html',
5+
})
6+
export class Comp {
7+
thing: string = '';
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig-base.json",
3+
"compilerOptions": {
4+
"module": "es2015",
5+
"moduleResolution": "node",
6+
"composite": false,
7+
"experimentalDecorators": true
8+
}
9+
}

0 commit comments

Comments
 (0)