Skip to content

Commit

Permalink
chore: resolve mr conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Stoehr committed Dec 19, 2024
2 parents 1ec5dfc + 05194d8 commit eb4a131
Show file tree
Hide file tree
Showing 466 changed files with 8,826 additions and 10,669 deletions.
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
codecov:
coverage:
precision: 1
round: up

54 changes: 49 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,59 @@
{
"env": {
"jest/globals": true
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": ["airbnb","react-app", "plugin:jest-dom/recommended", "plugin:testing-library/react"],
"extends": [
"airbnb",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:testing-library/react"
],
"globals": {
"page": true,
"document": true
"document": true,
"vi": true
},
"plugins": ["jest", "jest-dom", "react", "react-hooks", "testing-library"],
"plugins": [
"react",
"react-hooks",
"testing-library"
],
"rules": {
"import/no-unresolved": [
2, { "ignore": ["test-utils"] }
],
"import/prefer-default-export": "off",
"no-console": "off",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-vars": "off",
"no-undef": "off",
"no-restricted-syntax": ["warn", "WithStatement"],
"no-restricted-globals": ["error"],
"eqeqeq": ["warn", "smart"],
"no-use-before-define": [
"warn",
{
"functions": false,
"classes": false,
"variables": false
},
],
"no-mixed-operators": [
"warn",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"],
],
"allowSamePrecedence": false,
},
],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"require-jsdoc": ["error", {
"require": {
Expand All @@ -35,6 +75,7 @@
"default-param-last": "off",
"arrow-parens": "off",
"import/no-anonymous-default-export": "off",
"import/no-extraneous-dependencies": "off",
"max-len": ["error", {
"code": 120,
"ignoreComments": true,
Expand All @@ -44,6 +85,9 @@
}],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": [2, {
"functions": "defaultArguments"
}],
"react-hooks/exhaustive-deps": "error",
"testing-library/render-result-naming-convention": "off",
"testing-library/no-render-in-lifecycle": [
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master, mui5 ]
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
⚠️ This project is for Mirador 3, the latest version of Mirador. For Mirador 2, please see [ProjectMirador/mirador2](https://github.com/projectmirador/mirador2) or legacy documentation on the [Mirador 2 wiki](https://github.com/ProjectMirador/mirador-2-wiki/wiki). Please note that the community's focus is on Mirador 3, and are unlikely to accept pull requests or provide support for Mirador 2.
# Mirador
![Node.js CI](https://github.com/ProjectMirador/mirador/workflows/Node.js%20CI/badge.svg) [![codecov](https://codecov.io/gh/ProjectMirador/mirador/branch/master/graph/badge.svg)](https://codecov.io/gh/ProjectMirador/mirador)

Expand Down Expand Up @@ -75,15 +74,21 @@ store.getState()
```

## Running the tests
We use Vitest to run our test suite.

```sh
$ npm test # For headless CI=true npm test
$ npm test
```

or to continually watch the source files
You can see the helpful Vitest UI in your browser by running Vitest with the `--ui` flag. To pass the flag through to npm run the following:

```sh
$ npm run test:watch
$ npm test -- --ui
```

You can run Vitest without the additional linting and size checks in our `npm test` command. You can also test a single file:
```sh
$ npx vitest __tests__/integration/mirador/tests/sequence-switching.test.js --ui
```

## Linting the project
Expand Down
9 changes: 3 additions & 6 deletions __tests__/fixtures/version-2/broken.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<html>
<title>Error</title>
<body>
<p>Something went wrong</p>
</body>
</html>
{
"test": "Broken"
}
31 changes: 0 additions & 31 deletions __tests__/integration/mirador/annotations.test.js

This file was deleted.

20 changes: 4 additions & 16 deletions __tests__/integration/mirador/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,10 @@
</head>
<body>
<div id="mirador" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;"></div>
<script>document.write("<script type='text/javascript' src='../../../dist/mirador.min.js?v=" + Date.now() + "'><\/script>");</script>
<script type="text/javascript">
var miradorInstance = Mirador.viewer({
id: 'mirador',
windows: [
{
manifestId: 'https://purl.stanford.edu/ds199xg9454/iiif/manifest',
},
{
manifestId: 'https://edsilv.github.io/test-manifests/auth1-degraded.json'
},
{
manifestId: 'https://edsilv.github.io/test-manifests/auth1-standard.json'
}
],
});
<script type="module">
import Mirador from '../../../src';
import config from './mirador-configs/auth.js';
Mirador.viewer(config);
</script>
</body>
</html>
21 changes: 0 additions & 21 deletions __tests__/integration/mirador/basic.test.js

This file was deleted.

13 changes: 4 additions & 9 deletions __tests__/integration/mirador/blank.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@
</head>
<body>
<div id="mirador" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;"></div>
<script>document.write("<script type='text/javascript' src='../../../dist/mirador.min.js?v=" + Date.now() + "'><\/script>");</script>
<script type="text/javascript">
var miradorInstance = Mirador.viewer({
id: 'mirador',
windows: [],
theme: {
transitions: window.location.port === '4488' ? { create: () => 'none' } : {},
},
});
<script type="module">
import Mirador from '../../../src';
import config from './mirador-configs/blank.js';
Mirador.viewer(config);
</script>
</body>
</html>
24 changes: 4 additions & 20 deletions __tests__/integration/mirador/collections.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,10 @@
</head>
<body>
<div id="mirador" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;"></div>
<script>document.write("<script type='text/javascript' src='../../../dist/mirador.min.js?v=" + Date.now() + "'><\/script>");</script>
<script type="text/javascript">
var miradorInstance = Mirador.viewer({
id: 'mirador',
windows: [
{
collectionPath: [
"https://www.e-codices.unifr.ch/metadata/iiif/collection.json",
"https://www.e-codices.unifr.ch/metadata/iiif/collection/stabs.json"
],
manifestId: "https://www.e-codices.unifr.ch/metadata/iiif/stabs-StAlban-DD1-1580/manifest.json"
},
{
manifestId: 'https://www.e-codices.unifr.ch/metadata/iiif/collection.json'
}
],
catalog: [
{ manifestId: "https://www.e-codices.unifr.ch/metadata/iiif/collection.json" },
]
});
<script type="module">
import Mirador from '../../../src';
import config from './mirador-configs/collections.js';
Mirador.viewer(config);
</script>
</body>
</html>
32 changes: 0 additions & 32 deletions __tests__/integration/mirador/companion_windows.test.js

This file was deleted.

7 changes: 7 additions & 0 deletions __tests__/integration/mirador/components/AddComponentA.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

const AddComponentA = () => (
<div data-testid="add-plugin-component-a">Plugin A</div>
);

export default AddComponentA;
7 changes: 7 additions & 0 deletions __tests__/integration/mirador/components/AddComponentB.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

const AddComponentB = () => (
<div data-testid="add-plugin-component-b">Plugin B</div>
);

export default AddComponentB;
9 changes: 9 additions & 0 deletions __tests__/integration/mirador/components/AddComponentC.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';

const AddComponentC = (props) => (
<div id="add-plugin-component-c">
Plugin C
</div>
);

export default AddComponentC;
7 changes: 7 additions & 0 deletions __tests__/integration/mirador/components/AddComponentD.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const AddComponentD = (props) => (
<div id="add-plugin-component-d">
<input defaultValue="hello componentD"/>
</div>
);

export default AddComponentD;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';

const CompanionWindowButtonComponent = () => (
<span data-testid="add-plugin-companion-window-button" role="button">Companion Window Button Component</span>
);
CompanionWindowButtonComponent.value = 'specialMiradorKey';

export default CompanionWindowButtonComponent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';

const CompanionWindowComponent = (props) => (
<div data-testid="add-plugin-companion-window">
Companion Window Component
</div>
);

export default CompanionWindowComponent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const StateDependentComponent = (props) => (
<button id="plugin-button" onClick={props.incSomeNumber} style={{ width: 64 }}>
{ "Plugin:" + props.manifestId }
</button>
);

export default StateDependentComponent;
Loading

0 comments on commit eb4a131

Please sign in to comment.