|
@@ -5,13 +5,15 @@ use data which is put into the native clipboard by the application. For test pur
|
|
|
called `fixture` file.
|
|
called `fixture` file.
|
|
|
|
|
|
|
|
The `fixture` file is usually a HTML file containing HTML content which was fetched from the native browser `dataTransfer`
|
|
The `fixture` file is usually a HTML file containing HTML content which was fetched from the native browser `dataTransfer`
|
|
|
-object (`dataTransfer.getData( 'html/text' )`) when content have been pasted to the browser which ensures that `fixture`
|
|
|
|
|
|
|
+object (`dataTransfer.getData( 'html/text' )`) when content was pasted to the browser. This ensures that `fixture`
|
|
|
file provides exactly same data as a real use scenario.
|
|
file provides exactly same data as a real use scenario.
|
|
|
|
|
|
|
|
## Fixture files
|
|
## Fixture files
|
|
|
|
|
|
|
|
|
|
+_For example files see `_data/basic-style/bold-within-text/`_.
|
|
|
|
|
+
|
|
|
The `fixture` files are grouped per feature (which usually corresponds to editor plugins, for example `basic-styles`, `list`, etc).
|
|
The `fixture` files are grouped per feature (which usually corresponds to editor plugins, for example `basic-styles`, `list`, etc).
|
|
|
-All fixtures are stored in `tests/_data/feature-name/` directory (for example `_data/basic-style/`). Each feature (which
|
|
|
|
|
|
|
+All fixtures are stored in `_data/feature-name/` directory (for example `_data/basic-style/`). Each feature (which
|
|
|
will be called **group**) has a separate folder per fixture. Each fixture is used to create one normalization and one integration test.
|
|
will be called **group**) has a separate folder per fixture. Each fixture is used to create one normalization and one integration test.
|
|
|
|
|
|
|
|
Each fixture folder contains:
|
|
Each fixture folder contains:
|
|
@@ -21,13 +23,15 @@ Each fixture folder contains:
|
|
|
- normalized output fixture - `normalized.word2016.html`
|
|
- normalized output fixture - `normalized.word2016.html`
|
|
|
- model output fixture - `model.word2016.html`
|
|
- model output fixture - `model.word2016.html`
|
|
|
|
|
|
|
|
-In some cases, different browsers produces different input data. For such situations, additional fixtures should be added.
|
|
|
|
|
-For example if input data is different for Safari, additional `input.safari.word2016.html` file should be added.
|
|
|
|
|
|
|
+In some cases, different browsers produces different input data. For such situations, additional fixtures are stored.
|
|
|
|
|
+For example if input data is different for Safari, additional `input.safari.word2016.html` file will be present in fixture directory.
|
|
|
|
|
|
|
|
## Tests group index
|
|
## Tests group index
|
|
|
|
|
|
|
|
|
|
+_For example file see `_data/basic-style/index.js`_.
|
|
|
|
|
+
|
|
|
Each group of fixtures contains index file (`index.js` in group folder e.g. `_data/basic-styles/index.js`).
|
|
Each group of fixtures contains index file (`index.js` in group folder e.g. `_data/basic-styles/index.js`).
|
|
|
-Its purpose is to simply import all fixture files from its group and expose them for further use. Index file has the following structure:
|
|
|
|
|
|
|
+Its purpose is to simply import all fixture files from the group and expose them for further use. Index file has the following structure:
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
@@ -55,7 +59,7 @@ export const fixtures = {
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Such structure exports generic fixtures (the ones which are same for more than one browser and will be used if no browser specific fixtures are present).
|
|
|
|
|
|
|
+Such structure exports generic fixtures (the ones which are the same for more than one browser and will be used if no browser specific fixtures are present).
|
|
|
|
|
|
|
|
Index files must also export browser specific fixtures. In the simplest case if there are none, it exports empty object:
|
|
Index files must also export browser specific fixtures. In the simplest case if there are none, it exports empty object:
|
|
|
|
|
|
|
@@ -64,7 +68,7 @@ Index files must also export browser specific fixtures. In the simplest case if
|
|
|
export browserFixtures = {};
|
|
export browserFixtures = {};
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-If there are any browser specific fixtures, they are export in a similar manner than generic ones (apart from being grouped by a browser):
|
|
|
|
|
|
|
+If there are any browser specific fixtures, they are exported in a similar manner to generic ones (apart from being grouped by a browser):
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
```
|
|
@@ -107,6 +111,8 @@ export const browserFixtures = {
|
|
|
|
|
|
|
|
## Fixtures aggregation
|
|
## Fixtures aggregation
|
|
|
|
|
|
|
|
|
|
+_See `_utils/fixtures.js`_.
|
|
|
|
|
+
|
|
|
All group indexes files are aggregated in the `fixtures` util (`_utils/fixtures.js`) and exposed for tests in a single
|
|
All group indexes files are aggregated in the `fixtures` util (`_utils/fixtures.js`) and exposed for tests in a single
|
|
|
`fixtures` and `browserFixtures` objects:
|
|
`fixtures` and `browserFixtures` objects:
|
|
|
|
|
|
|
@@ -128,8 +134,10 @@ export const browserFixtures = {
|
|
|
|
|
|
|
|
## Tests generation
|
|
## Tests generation
|
|
|
|
|
|
|
|
|
|
+_See `data/normalization.js` and `data/integration.js`_.
|
|
|
|
|
+
|
|
|
Tests based on fixture files are generated by the special util function `generateTests()` (see `_utils/utils.js`). This function
|
|
Tests based on fixture files are generated by the special util function `generateTests()` (see `_utils/utils.js`). This function
|
|
|
-is specially designed to generate `normalization` (see `data/normalization.js`) or `integration` (see `data/integration.js`)
|
|
|
|
|
|
|
+is specifically designed to generate `normalization` (see `data/normalization.js`) or `integration` (see `data/integration.js`)
|
|
|
tests using provided fixtures group, for example:
|
|
tests using provided fixtures group, for example:
|
|
|
|
|
|
|
|
|
|
|