Skip to content

Commit

Permalink
feat(demos): use blueprint components for amd-module-loader demo (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
clebert authored Dec 20, 2018
1 parent 482af0f commit 2013ffc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
7 changes: 6 additions & 1 deletion packages/demos/src/amd-module-loader/feature-app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {Card, Label} from '@blueprintjs/core';
import {ReactFeatureApp} from '@feature-hub/react';
import * as React from 'react';

Expand All @@ -6,7 +7,11 @@ export default {

create(): ReactFeatureApp {
return {
render: () => <span>Hello, World!</span>
render: () => (
<Card style={{margin: '20px'}}>
<Label>Hello, World!</Label>
</Card>
)
};
}
};
11 changes: 6 additions & 5 deletions packages/demos/src/amd-module-loader/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@

import {Server} from 'http';
import {AddressInfo} from 'net';
import {Browser} from '../browser';
import {startServer} from '../start-server';
import webpackConfigs from './webpack-config';

jest.setTimeout(60000);

describe('integration test: "amd module loader"', () => {
const browser = new Browser(5000);

let server: Server;

beforeAll(async () => {
server = await startServer(webpackConfigs);
});

afterAll(done => server.close(done));

beforeEach(async () => {
const {port} = server.address() as AddressInfo;

await page.goto(`http://localhost:${port}`);
await browser.goto(`http://localhost:${port}`, 60000);
});

afterAll(done => server.close(done));

it('loads the feature app with react as external', async () => {
await expect(page).toMatch('Hello, World!');
});
Expand Down
3 changes: 3 additions & 0 deletions packages/demos/src/amd-module-loader/integrator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import {FeatureAppLoader} from '@feature-hub/react';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

// tslint:disable-next-line:no-import-side-effect
import '../blueprint-css';

const registry = new FeatureServiceRegistry();
const manager = new FeatureAppManager(registry, {moduleLoader: loadAmdModule});

Expand Down
5 changes: 5 additions & 0 deletions packages/demos/src/blueprint-css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// tslint:disable

import 'normalize.css/normalize.css';
import '@blueprintjs/icons/lib/css/blueprint-icons.css';
import '@blueprintjs/core/lib/css/blueprint.css';
7 changes: 2 additions & 5 deletions packages/demos/src/history-service/integrator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import * as ReactDOM from 'react-dom';
import {historyConsumerDefinition} from './history-consumer-definition';
import {rootLocationTransformer} from './root-location-transformer';

// tslint:disable
import 'normalize.css/normalize.css';
import '@blueprintjs/icons/lib/css/blueprint-icons.css';
import '@blueprintjs/core/lib/css/blueprint.css';
// tslint:enable
// tslint:disable-next-line:no-import-side-effect
import '../blueprint-css';

const registry = new FeatureServiceRegistry();

Expand Down

0 comments on commit 2013ffc

Please sign in to comment.