Skip to content

Commit

Permalink
Merge branch '2.3.0' into search-within
Browse files Browse the repository at this point in the history
  • Loading branch information
versae committed Mar 22, 2017
2 parents e69e018 + 37c3062 commit 3b4bfcc
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 21 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: node_js
sudo: false
node_js:
- '5'
- 'node'
before_install:
- npm install
script:
Expand Down
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = function(grunt) {

// source files
sources = [
'js/src/mirador.js',
'js/src/mirador.js',
'js/src/utils/handlebars.js',
'js/src/*.js',
'js/src/viewer/*.js',
Expand Down Expand Up @@ -222,7 +222,7 @@ module.exports = function(grunt) {
'locales/*/*.json',
'images/*',
'css/*.css',
'css/mirador/**/*.less',
'css/mirador.less/**/*.less',
'index.html'
],
tasks: 'dev_build'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"grunt-template-jasmine-istanbul": "^0.3.3",
"jasmine-core": "^2.1.3",
"jasmine-jquery": "^2.0.5",
"karma": "^0.12.16",
"karma": "^1.5",
"karma-chrome-launcher": "^0.1.7",
"karma-coverage": "^0.2.7",
"karma-coveralls": "^1.1.2",
Expand Down
70 changes: 52 additions & 18 deletions spec/annotations/osd-svg-overlay.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
paper.install(window);

describe('Overlay', function() {

function getEvent(delta, point, lastPoint, event) {
Expand Down Expand Up @@ -79,23 +77,23 @@ describe('Overlay', function() {

var state = new Mirador.SaveController({eventEmitter: this.eventEmitter}); // TODO should stub this

state.getStateProperty = function(key) {
if (key === 'drawingToolsSettings') {
return {
'doubleClickReactionTime': 300,
'strokeColor': 'deepSkyBlue',
'fillColor': 'deepSkyBlue',
'fillColorAlpha': 0.0
};
}
if (key === 'availableAnnotationDrawingTools') {
return [];
}
if (key === 'availableExternalCommentsPanel') {
return false;
}
return null;
state.getStateProperty = function(key) {
if (key === 'drawingToolsSettings') {
return {
'doubleClickReactionTime': 300,
'strokeColor': 'deepSkyBlue',
'fillColor': 'deepSkyBlue',
'fillColorAlpha': 0.0
};
}
if (key === 'availableAnnotationDrawingTools') {
return [];
}
if (key === 'availableExternalCommentsPanel') {
return false;
}
return null;
};

this.overlay = new Mirador.Overlay(this.viewerMock, this.windowObjMock.viewer.id, this.windowObjMock.windowId, state, new MockEventEmitter(this.eventEmitter));
this.overlay.annotationUtils = new AnnotationUtilsStub();
Expand Down Expand Up @@ -534,4 +532,40 @@ describe('Overlay', function() {
expect(paperScope.tools.length).toEqual(0);
});

describe("When there are two overlays: ", function() {

beforeEach(function() {
var state = new Mirador.SaveController({eventEmitter: this.eventEmitter});

this.overlay2 = new Mirador.Overlay(this.viewerMock, this.windowObjMock.viewer.id, this.windowObjMock.windowId, state, new MockEventEmitter(this.eventEmitter));
this.overlay2.annotationUtils = new AnnotationUtilsStub();
});

afterEach(function() {
delete this.overlay2;
});

it("creates different paperScopes for each overlay", function() {
expect(this.overlay.paperScope._id).not.toEqual(this.overlay2.paperScope._id);
});

it("the global paper object should be set to the most recently instantiated paperScope", function() {
// since overlay2 was created most recently, the global paper object should be set to the paperScope of overlay2
expect(paper._id).toEqual(this.overlay2.paperScope._id);
});

it("correctly sets the global paper object when an overlay's setMouseTool method is called", function(){
// make sure the global paper object is set to the paperScope of overlay2
expect(paper._id).toEqual(this.overlay2.paperScope._id);
// call setMouseTool on the first overlay
this.overlay.setMouseTool();
// make sure the global paper object is set to the paperScope of the first overlay
expect(paper._id).toEqual(this.overlay.paperScope._id);
// call setMouseTool on overlay2 and check the global paper object again
this.overlay2.setMouseTool();
expect(paper._id).toEqual(this.overlay2.paperScope._id);
expect(paper._id).not.toEqual(this.overlay.paperScope._id);
});
});

});

0 comments on commit 3b4bfcc

Please sign in to comment.