Skip to content

Commit 7b0c6d3

Browse files
committed
Use context to pass the window id around
1 parent e0cfcc7 commit 7b0c6d3

92 files changed

Lines changed: 261 additions & 157 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

__tests__/src/components/CompanionArea.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ describe('CompanionArea', () => {
5656
const wrapper = createWrapper();
5757
const props = wrapper.find(CompanionWindowFactory).at(0).props();
5858
expect(props.id).toBe('foo');
59-
expect(props.windowId).toBe('abc123');
6059
});
6160

6261
it('has a toggle to show the companion area window in the left position', () => {

__tests__/src/components/LayersPanel.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ describe('LayersPanel', () => {
2626
canvasId: 'a',
2727
index: 0,
2828
totalSize: 2,
29-
windowId: 'window',
3029
});
3130

3231
expect(wrapper.find(CanvasLayers).at(1).props()).toMatchObject({
3332
canvasId: 'b',
3433
index: 1,
3534
totalSize: 2,
36-
windowId: 'window',
3735
});
3836
});
3937
});

__tests__/src/components/SearchPanel.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('SearchPanel', () => {
5252

5353
it('has the SearchPanelControls component', () => {
5454
const titleControls = createWrapper().find(CompanionWindow).prop('titleControls');
55-
expect(titleControls.type.displayName).toEqual('Connect(WithStyles(WithPlugins(SearchPanelControls)))');
55+
expect(titleControls.type.displayName).toEqual('WithStyles(WithWindowContext(Connect(WithPlugins(SearchPanelControls))))');
5656
});
5757
it('has the SearchResults', () => {
5858
const wrapper = createWrapper();

__tests__/src/components/SearchPanelControls.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('SearchPanelControls', () => {
2323
it('renders a form and navigation', () => {
2424
const wrapper = createWrapper();
2525
expect(wrapper.find('form').length).toEqual(1);
26-
expect(wrapper.find('Connect(WithStyles(WithPlugins(SearchPanelNavigation)))').length).toEqual(1);
26+
expect(wrapper.find('WithStyles(WithWindowContext(Connect(WithPlugins(SearchPanelNavigation))))').length).toEqual(1);
2727
});
2828

2929
it('submits a search when an autocomplete suggestion is picked', () => {

__tests__/src/components/SearchResults.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ describe('SearchResults', () => {
3030
it('renders a SearchHit for each hit', () => {
3131
const selectContentSearchAnnotation = jest.fn();
3232
const wrapper = createWrapper({ selectContentSearchAnnotation });
33-
const searchHits = wrapper.find('Connect(WithStyles(WithPlugins(SearchHit)))');
33+
const searchHits = wrapper.find('WithStyles(WithWindowContext(Connect(WithPlugins(SearchHit))))');
3434
expect(searchHits.length).toEqual(1);
3535
expect(searchHits.first().props().index).toEqual(0);
3636
});
3737

3838
it('can focus on a single item', () => {
3939
const wrapper = createWrapper({});
40-
const searchHits = wrapper.find('Connect(WithStyles(WithPlugins(SearchHit)))');
40+
const searchHits = wrapper.find('WithStyles(WithWindowContext(Connect(WithPlugins(SearchHit))))');
4141

4242
searchHits.first().props().showDetails();
4343
expect(wrapper.state().focused).toEqual(true);
@@ -59,7 +59,7 @@ describe('SearchResults', () => {
5959
searchHits: [],
6060
});
6161

62-
const searchHits = wrapper.find('Connect(WithStyles(WithPlugins(SearchHit)))');
62+
const searchHits = wrapper.find('WithStyles(WithWindowContext(Connect(WithPlugins(SearchHit))))');
6363
expect(searchHits.length).toEqual(2);
6464
expect(searchHits.get(0).props.index).toEqual(0);
6565
expect(searchHits.get(0).props.annotationId).toEqual('x');

__tests__/src/components/WindowSideBarAnnotationsPanel.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('WindowSideBarAnnotationsPanel', () => {
3030

3131
it('has the AnnotationSettings component', () => {
3232
const titleControls = createWrapper().prop('titleControls');
33-
expect(titleControls.type.displayName).toEqual('Connect(WithPlugins(AnnotationSettings))');
33+
expect(titleControls.type.displayName).toEqual('WithWindowContext(Connect(WithPlugins(AnnotationSettings)))');
3434
});
3535

3636
it('renders the annotationsCount', () => {

__tests__/src/components/WindowTopBar.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ describe('WindowTopBar', () => {
5656

5757
it('passes correct props to <WindowTopBarButtons/>', () => {
5858
const wrapper = createWrapper();
59-
expect(wrapper.find(WindowTopBarPluginMenu).first().props().windowId).toBe('xyz');
59+
expect(wrapper.find(WindowTopBarPluginMenu).length).toEqual(1);
6060
});
6161

6262
it('passe correct props to <WindowTopMenuButton', () => {
6363
const wrapper = createWrapper();
64-
expect(wrapper.find(WindowTopMenuButton).first().props().windowId).toBe('xyz');
64+
expect(wrapper.find(WindowTopMenuButton).length).toEqual(1);
6565
});
6666

6767
it('passes correct props to <Button/>', () => {

__tests__/src/components/WindowTopMenu.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ describe('WindowTopMenu', () => {
2929

3030
it('passes windowId to <WindowThumbnailSettings/>', () => {
3131
const wrapper = createWrapper();
32-
expect(wrapper.find(WindowThumbnailSettings)
33-
.first().props().windowId).toBe('xyz');
32+
expect(wrapper.find(WindowThumbnailSettings).length).toBe(1);
3433
});
3534

3635
it('passses correct props to <Menu/> when no achor element given', () => {

__tests__/src/components/WindowTopMenuButton.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe('WindowTopMenuButton', () => {
2626
const wrapper = createWrapper();
2727
const props = wrapper.find(WindowTopMenu).first().props();
2828
const { handleMenuClose } = wrapper.instance();
29-
expect(props.windowId).toBe('xyz');
3029
expect(props.anchorEl).toBe(null);
3130
expect(props.handleClose).toBe(handleMenuClose);
3231
});

__tests__/src/components/WindowViewer.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ describe('WindowViewer', () => {
2424
describe('when lazy imorts have loaded', () => {
2525
it('renders expected components', () => {
2626
wrapper = createWrapper({}, false);
27-
expect(wrapper.find('lazy').props().windowId).toBe('xyz');
28-
expect(wrapper.find(WindowCanvasNavigationControls).props().windowId).toBe('xyz');
27+
expect(wrapper.find(WindowCanvasNavigationControls).length).toBe(1);
2928
});
3029
});
3130
});

0 commit comments

Comments
 (0)