Skip to content
Snippets Groups Projects
Commit dbc872b3 authored by Andrew Winget (Standard)'s avatar Andrew Winget (Standard)
Browse files

fixes old tests, tests new reducers

parent 7b9a46f1
Branches
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ function createWrapper(props) {
describe('App', () => {
it('should render outer element correctly', () => {
const wrapper = createWrapper();
expect(wrapper.find('div.mirador-app').length).toBe(1);
expect(wrapper.find('div.mirador-viewer').length).toBe(1);
});
it('should render all needed elements ', () => {
......
......@@ -230,4 +230,87 @@ describe('windows reducer', () => {
},
});
});
it('should handle UPDATE_VIEWPORT', () => {
expect(windowsReducer({
abc123: {
id: 'abc123',
},
def456: {
id: 'def456',
},
}, {
type: ActionTypes.UPDATE_VIEWPORT,
windowId: 'abc123',
payload: { x: 0, y: 1, zoom: 0.5 },
})).toEqual({
abc123: {
id: 'abc123',
viewer: { x: 0, y: 1, zoom: 0.5 },
},
def456: {
id: 'def456',
},
});
});
it('should handle SET_WINDOW_SIZE', () => {
expect(reducer({
abc123: {
id: 'abc123',
},
def456: {
id: 'def456',
},
}, {
type: ActionTypes.SET_WINDOW_SIZE,
payload: {
windowId: 'abc123',
size: {
x: 20,
y: 20,
width: 200,
height: 200,
},
},
})).toEqual({
abc123: {
id: 'abc123',
x: 20,
y: 20,
width: 200,
height: 200,
},
def456: {
id: 'def456',
},
});
});
it('should handle UPDATE_WINDOW_POSITION', () => {
expect(reducer({
abc123: {
id: 'abc123',
},
def456: {
id: 'def456',
},
}, {
type: ActionTypes.UPDATE_WINDOW_POSITION,
payload: {
windowId: 'abc123',
position: {
x: 20,
y: 20,
},
},
})).toEqual({
abc123: {
id: 'abc123',
x: 20,
y: 20,
},
def456: {
id: 'def456',
},
});
});
});
......@@ -42,4 +42,27 @@ describe('workspace reducer', () => {
isWorkspaceAddVisible: true,
});
});
it('should handle SET_WORKSPACE_VIEWPORT_POSITION', () => {
expect(reducer([], {
type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
payload: {
position: {
x: 50,
y: 50,
},
},
})).toEqual({
viewportPosition: {
x: 50,
y: 50,
},
});
});
it('should handle TOGGLE_WORKSPACE_EXPOSE_MODE', () => {
expect(reducer([], {
type: ActionTypes.TOGGLE_WORKSPACE_EXPOSE_MODE,
})).toEqual({
exposeModeOn: true,
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment