-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scaffolding for a simple binding for tests
- Loading branch information
Showing
9 changed files
with
138 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## API Report File for "@microsoft/fast-btr" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Server | ||
This project contains the web server that playwright tests are run against. To build, run `npm run build-server`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { Readable } from "stream"; | ||
|
||
import express, { Request, Response } from "express"; | ||
|
||
const __dirname = path.resolve(path.dirname("")); | ||
const PORT = 8080; | ||
|
||
function handlePathRequest( | ||
mapPath: string, | ||
contentType: string, | ||
req: Request, | ||
res: Response | ||
) { | ||
res.set("Content-Type", contentType); | ||
fs.readFile(path.resolve(__dirname, mapPath), { encoding: "utf8" }, (err, data) => { | ||
const stream = (Readable as any).from(data); | ||
|
||
stream.on("readable", function (this: any) { | ||
while ((data = this.read())) { | ||
res.write(data); | ||
} | ||
}); | ||
stream.on("close", () => res.end()); | ||
stream.on("error", (e: Error) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); | ||
}); | ||
} | ||
|
||
const app = express(); | ||
app.get("/binding", (req: Request, res: Response) => | ||
handlePathRequest("./src/fixtures/binding.fixture.html", "text/html", req, res) | ||
); | ||
app.listen(PORT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"rootDir": ".", | ||
"outDir": "dist" | ||
}, | ||
"references": [{ "path": "../src"}] | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/web-components/fast-btr/src/fixtures/binding.fixture.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title></title> | ||
</head> | ||
<body> | ||
<custom-element text="Hello world"> | ||
<template shadowrootmode="open"> | ||
Hello world | ||
</template> | ||
</custom-element> | ||
<f-template name="custom-element"> | ||
<template> | ||
{{text}} | ||
</template> | ||
</f-template> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
packages/web-components/fast-btr/src/fixtures/binding.fixture.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"text": "Hello world" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"rootDir": ".", | ||
"outDir": "../dist/esm", | ||
"declarationDir": "../dist/dts", | ||
"lib": [ | ||
"dom", | ||
"esnext" | ||
], | ||
}, | ||
} |