From fd5f35fd6a50895bd1b97b6c268b35e7789ee9d2 Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Fri, 12 Oct 2018 09:31:50 -0700 Subject: [PATCH] feat(server): .dom files include HTML tags in page. Add support for .dom extension files, insert the content of the file into the test HTML document. This allows 'component' tests where JS interacts with HTML. Provides a simpler alternative to solutions that use JS to embed HTML in JS then write it into the DOM. Limited to cases where the DOM fragments from different tests do not interfere. --- docs/config/02-files.md | 18 ++++++----- lib/middleware/karma.js | 22 ++++++++++++-- lib/server.js | 2 ++ lib/web-server.js | 23 ++++++++++++-- test/unit/middleware/karma.spec.js | 48 ++++++++++++++++++++++++++++++ test/unit/web-server.spec.js | 4 ++- 6 files changed, 105 insertions(+), 12 deletions(-) diff --git a/docs/config/02-files.md b/docs/config/02-files.md index 7cd632082..91de57174 100644 --- a/docs/config/02-files.md +++ b/docs/config/02-files.md @@ -34,6 +34,10 @@ Each pattern is either a simple string or an object with the following propertie * `js` * `dart` * `module` + * `dom` +* **Description.** The type determines the mechanism for including the file. The `css` and `html` types +create `link` elements; the `js`, `dart`, and `module` elements create `script` elements. The `dom` type +includes the file content in the page, used, for example, to test components combinging HTML and JS. ### `watched` * **Type.** Boolean @@ -46,17 +50,17 @@ Each pattern is either a simple string or an object with the following propertie * **Description.** Should the files be included in the browser using `