Skip to content
Snippets Groups Projects
Unverified Commit 5da108e7 authored by Camille Villa's avatar Camille Villa Committed by GitHub
Browse files

Remove "core" module fixes #2905 (#2910)

Remove "core" module fixes #2905
parents b0626e9d bf210ca4
No related branches found
No related tags found
No related merge requests found
describe('Plain JavaScript example', () => {
beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/vanilla-js/');
});
it('has the correct page title', async () => {
const title = await page.title();
expect(title).toBe('Examples');
});
it('loads a manifest and displays it', async () => {
await expect(page).toFill('#manifestURL', 'http://localhost:5000/api/sn904cj3429');
await expect(page).toClick('#fetchBtn');
// TODO: Refactor the app so we get rid of the wait
await page.waitFor(1000);
const manifest = await page.$eval('#exampleManifest', e => e.innerHTML);
await expect(manifest).toMatch(/http:\/\/iiif\.io\/api\/presentation\/2\/context\.json/);
});
});
## Notes
To load external manifests, you will need to run the example pages from a serve. One easy way to do this is to run PythonHTTPServer:
`python -m SimpleHTTPServer`
To inspect the Mirador 3 prototype in the web console with (code completion), you can refer to it as:
`m3core`
This name is found in the `minimal_redux_poc/webpack.config.js` as the value of the `library` property.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Examples</title>
<script src="../../../dist/m3core.umd.js"></script>
</head>
<body>
<input id="manifestURL" type="text"/><button id="fetchBtn" type="submit">Fetch Manifest</button>
<pre id="exampleManifest">
</pre>
<script>
document.getElementById("fetchBtn").addEventListener("click", function(){
let val = document.getElementById("manifestURL").value;
let f = m3core.actions.fetchManifest(val);
m3core.store.dispatch(f);
});
m3core.store.subscribe(() => {
let contents = ''
let state = m3core.store.getState();
let manifest = state.manifests[document.getElementById("manifestURL").value];
switch (manifest.isFetching) {
case true:
contents = 'spinner';
break;
case false:
if(manifest.error){
contents = manifest.error.message;
} else {
contents = JSON.stringify(manifest.json, 0, 3);
}
break;
default: contents = ''
}
document.getElementById("exampleManifest").innerHTML = contents;
});
</script>
</body>
</html>
import createStore from './state/createStore';
import * as actions from './state/actions';
const store = createStore();
export { store, actions };
......@@ -15,20 +15,6 @@ const babelLoaderConfig = {
test: /\.(js|mjs|jsx)$/,
};
const baseConfig = [
{
entry: './src/index-core.js',
module: {
rules: [
babelLoaderConfig,
],
},
output: {
filename: 'm3core.umd.js',
library: 'm3core',
libraryTarget: 'umd',
path: path.join(__dirname, 'dist'),
},
},
{
entry: ['./src/polyfills.js', './src/index.js'],
module: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment