Skip to content
Merged

Next #207

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nullstack",
"version": "0.15.1",
"version": "0.15.2",
"description": "Full-stack Javascript Components for one-dev armies",
"main": "nullstack.js",
"author": "Mortaro",
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Application.njs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import UnderscoredAttributes from './UnderscoredAttributes';
import Vunerability from './Vunerability';
import WindowDependency from './WindowDependency';
import WorkerVerbs from './WorkerVerbs';
import MetatagState from './MetatagState';

class Application extends Nullstack {

Expand Down Expand Up @@ -109,6 +110,7 @@ class Application extends Nullstack {
<WebpackCustomPlugin route="/webpack-custom-plugin" />
<ComponentTernary route="/component-ternary" />
<AnchorModifiers route="/anchor-modifiers" />
<MetatagState route="/metatag-state" />
<ErrorPage route="*" />
</main>
)
Expand Down
15 changes: 15 additions & 0 deletions tests/src/MetatagState.njs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Nullstack from 'nullstack';

class MetatagState extends Nullstack {

html = '&quot;nullstack&quot;';

render() {
return (
<div html={this.html}/>
)
}

}

export default MetatagState;
19 changes: 19 additions & 0 deletions tests/src/MetatagState.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let hasConsoleError = false;
let originalConsole = console.error;

beforeAll(async () => {
console.error = jest.fn(() => hasConsoleError = true);
await page.goto('http://localhost:6969/metatag-state');
});

describe('MetatagState', () => {

test('state stored at metatag can be retrieved without errors', async () => {
expect(hasConsoleError).toBeFalsy();
});

});

afterAll(async () => {
console.error = originalConsole;
});
2 changes: 1 addition & 1 deletion tests/src/RenderableComponent.njs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RenderableComponent extends Nullstack {

render({ params }) {
const list = params.shortList ? [1, 2, 3] : [1, 2, 3, 4, 5, 6]
const html = '<a href="/"> "Nullstack" </a>';
const html = '<a href="/"> Nullstack </a>';
return (
<div class="RenderableComponent">
<Falsy />
Expand Down
2 changes: 1 addition & 1 deletion workers/staticHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function extractData(response) {
const html = await response.clone().text();
const stateLookup = '<meta name="nullstack" content="';
const state = html.split("\n").find((line) => line.indexOf(stateLookup) > -1).split(stateLookup)[1].slice(0, -2);
const { instances, page } = JSON.parse(decodeURI(state));
const { instances, page } = JSON.parse(decodeURIComponent(state));
const json = JSON.stringify({ instances, page });
return new Response(json, {
headers: { 'Content-Type': 'application/json' }
Expand Down