Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Sinon to v4.1.2 & remove deprecated methods from tests #529

Merged
merged 3 commits into from
Dec 5, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"value-no-vendor-prefix": true,
"number-leading-zero": never,
"declaration-no-important": true,
"no-descending-specificity": null,
"order/properties-alphabetical-order": [true, { "severity": "warning" }]
}
}
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"url": "git@github.com:box/box-content-preview.git"
},
"devDependencies": {
"@commitlint/cli": "^4.2.2",
"autoprefixer": "^7.1.6",
"@commitlint/cli": "^5.2.0",
"autoprefixer": "^7.2.1",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.2",
"babel-eslint": "^8.0.3",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-class-properties": "^6.23.0",
Expand All @@ -21,24 +21,24 @@
"babel-plugin-transform-require-ignore": "^0.1.1",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-es2016": "^6.22.0",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.23.0",
"box-annotations": "^0.5.1",
"chai": "^4.1.2",
"chai-dom": "^1.5.0",
"conventional-changelog-cli": "^1.3.4",
"conventional-changelog-cli": "^1.3.5",
"conventional-github-releaser": "^2.0.0",
"create-react-class": "^15.6.2",
"css-loader": "^0.28.7",
"cssnano-cli": "^1.0.5",
"eslint": "^4.7.2",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.7.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react": "^7.5.1",
"extract-text-webpack-plugin": "3.0.2",
"fetch-mock": "^5.13.1",
"fetch-mock-forwarder": "^1.0.0",
Expand All @@ -60,37 +60,37 @@
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.5",
"lint-staged": "^4.3.0",
"karma-webpack": "^2.0.6",
"lint-staged": "^5.0.0",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"mocha": "^4.0.1",
"mock-local-storage": "^1.0.2",
"mojito-rb-gen": "^0.0.1",
"node-noop": "^1.0.0",
"node-sass": "^4.6.0",
"node-sass": "^4.7.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"phantomjs-prebuilt": "^2.1.16",
"postcss-loader": "^2.0.8",
"prettier": "^1.8.1",
"prettier-eslint-cli": "^4.4.0",
"postcss-loader": "^2.0.9",
"prettier": "^1.8.2",
"prettier-eslint-cli": "^4.4.2",
"raw-loader": "^0.5.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-virtualized": "^9.12.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-virtualized": "^9.13.0",
"sass-loader": "^6.0.6",
"selenium-webdriver": "^3.6.0",
"sinon": "^1.17.7",
"sinon": "^4.1.2",
"sinon-chai": "2.14.0",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.19.0",
"stylelint": "^8.2.0",
"stylelint-config-standard": "^17.0.0",
"stylelint": "^8.3.1",
"stylelint-config-standard": "^18.0.0",
"stylelint-order": "^0.7.0",
"stylelint-scss": "^2.1.0",
"webpack": "^3.8.1",
"webpack-bundle-analyzer": "^2.8.3",
"stylelint-scss": "^2.2.0",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
"whatwg-fetch": "^2.0.3"
},
"scripts": {
Expand Down
16 changes: 7 additions & 9 deletions src/lib/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,6 @@ $header-height: 48px;
}
}

.bp-popup-modal {
left: 0;
margin: 0 auto;
position: absolute;
right: 0;
top: 100px;
}

//---------- Override popup related CSS from _boxui.scss ----------//
.bp-modal-dialog {
padding: 20px;
Expand Down Expand Up @@ -262,7 +254,13 @@ $header-height: 48px;
margin: 0 auto;
}

// z-index as the base modal
.bp-popup-modal {
left: 0;
margin: 0 auto;
position: absolute;
right: 0;
top: 100px;

// z-index as the base modal
z-index: 160; // follows bp-modal from boxui
}
17 changes: 7 additions & 10 deletions src/lib/_loading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,6 @@
}
}

// Center spinner horizontally and vertically within container
.bp-spinner {
bottom: 0;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
}

.bp-spinner div,
.bp-spinner div::after {
border: 25px solid #0061d5;
Expand All @@ -140,8 +130,15 @@
transform: rotate(90deg);
}

// Center spinner horizontally and vertically within container
.bp-spinner {
bottom: 0;
height: 30px;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
transform: translate(-15px, -15px) scale(.15) translate(15px, 15px);
width: 30px;
}
30 changes: 15 additions & 15 deletions src/lib/viewers/box3d/__tests__/Box3DRenderer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
});

it('should append "boxapi" request header to the XHR with the provided shared link', () => {
sandbox.stub(window, 'encodeURI', (uri) => {
sandbox.stub(window, 'encodeURI').callsFake((uri) => {
return uri;
});
const setReqHeaderSpy = sandbox.spy(XMLHttpRequest.prototype, 'setRequestHeader');
Expand All @@ -196,7 +196,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
});

it('should append "boxapi" request header to the XHR with the shared link AND shared link password', () => {
sandbox.stub(window, 'encodeURI', (uri) => {
sandbox.stub(window, 'encodeURI').callsFake((uri) => {
return uri;
});
const setReqHeaderSpy = sandbox.spy(XMLHttpRequest.prototype, 'setRequestHeader');
Expand Down Expand Up @@ -267,7 +267,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
two: 'b'
};

const creatBox3DStub = sandbox.stub(renderer, 'createBox3d', (loader, entities) => {
const creatBox3DStub = sandbox.stub(renderer, 'createBox3d').callsFake((loader, entities) => {
expect(entities).to.deep.equal(expectedEntities);
done();
});
Expand All @@ -279,12 +279,12 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
});

it('should produce an XhrResourceLoader which supports token, sharedLink and sharedLinkPassword', (done) => {
const creatBox3DStub = sandbox.stub(renderer, 'createBox3d', (loader) => {
sandbox.stub(loader.queue, 'add', (fn) => fn());
const creatBox3DStub = sandbox.stub(renderer, 'createBox3d').callsFake((loader) => {
sandbox.stub(loader.queue, 'add').callsFake((fn) => fn());
const resource = {
once: (event, cb) => cb()
};
sandbox.stub(loader, 'load', () => resource);
sandbox.stub(loader, 'load').callsFake(() => resource);

loader.load('path/to/texture.jpg', window.Box3D.LoadingType.IMAGE, {});

Expand Down Expand Up @@ -368,7 +368,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
load: function load() {}
});
this.canvas = { addEventListener: () => {}};
sandbox.stub(this.canvas, 'addEventListener', () => {
sandbox.stub(this.canvas, 'addEventListener').callsFake(() => {
renderer.handleContextRestored()
})
}
Expand Down Expand Up @@ -433,7 +433,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {

describe('handleContextRestored()', () => {
it('should fire event to be picked up by the viewer', () => {
const emitStub = sandbox.stub(renderer, 'emit', (eventName) => {
const emitStub = sandbox.stub(renderer, 'emit').callsFake((eventName) => {
expect(eventName).to.equal(EVENT_WEBGL_CONTEXT_RESTORED);
});
renderer.handleContextRestored();
Expand All @@ -444,7 +444,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
describe('toggleVr()', () => {
it('should enable vr if it\'s currently disabled', () => {
let called = false;
sandbox.stub(renderer, 'enableVr', () => {
sandbox.stub(renderer, 'enableVr').callsFake(() => {
called = true;
});
renderer.toggleVr();
Expand All @@ -453,7 +453,7 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {

it('should disable vr if it\'s currently enabled', () => {
let called = false;
sandbox.stub(renderer, 'disableVr', () => {
sandbox.stub(renderer, 'disableVr').callsFake(() => {
called = true;
});
renderer.vrEnabled = true;
Expand Down Expand Up @@ -658,27 +658,27 @@ describe('lib/viewers/box3d/Box3DRenderer', () => {
});

it('should emit a EVENT_SHOW_VR_BUTTON event when vr displays are ready', (done) => {
sandbox.stub(vrPresenter, 'whenDisplaysAvailable', (callback) => {
sandbox.stub(vrPresenter, 'whenDisplaysAvailable').callsFake((callback) => {
callback([{}, {}]);
done();
});
sandbox.stub(renderer, 'createVrGamepads', () => {});
sandbox.stub(renderer, 'createVrGamepads').callsFake(() => {});
renderer.initVr();
expect(emitStub).to.be.calledWith(EVENT_SHOW_VR_BUTTON);
});

it('should add an event listeners for vr enabled/disabled events via listenTo', (done) => {
box3dMock.expects('listenTo').twice();
sandbox.stub(vrPresenter, 'whenDisplaysAvailable', (callback) => {
sandbox.stub(vrPresenter, 'whenDisplaysAvailable').callsFake((callback) => {
callback([{}, {}]);
done();
});
sandbox.stub(renderer, 'createVrGamepads', () => {});
sandbox.stub(renderer, 'createVrGamepads').callsFake(() => {});
renderer.initVr();
});

it('should do nothing if no displays are available', (done) => {
sandbox.stub(vrPresenter, 'whenDisplaysAvailable', (callback) => {
sandbox.stub(vrPresenter, 'whenDisplaysAvailable').callsFake((callback) => {
callback([]);
done();
});
Expand Down
8 changes: 4 additions & 4 deletions src/lib/viewers/box3d/__tests__/Box3DViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ describe('lib/viewers/box3d/Box3DViewer', () => {
describe('handleSceneLoaded()', () => {
let eventNameUsed;
beforeEach(() => {
sandbox.stub(box3d, 'emit', (eventName) => {
sandbox.stub(box3d, 'emit').callsFake((eventName) => {
eventNameUsed = eventName;
});
box3d.controls.addUi = sandbox.stub();
Expand Down Expand Up @@ -525,7 +525,7 @@ describe('lib/viewers/box3d/Box3DViewer', () => {
describe('handleError()', () => {
it('should call emit() with params ["error", error_object]', () => {
const error = {};
const emitStub = sandbox.stub(box3d, 'emit', (eventName, errorObj) => {
const emitStub = sandbox.stub(box3d, 'emit').callsFake((eventName, errorObj) => {
expect(eventName).to.equal(EVENT_ERROR);
expect(errorObj).to.equal(error);
});
Expand All @@ -538,15 +538,15 @@ describe('lib/viewers/box3d/Box3DViewer', () => {

describe('handleContextLost()', () => {
it('should call destroySubModules', () => {
const destroySubModules = sandbox.stub(box3d, 'destroySubModules', () => {});
const destroySubModules = sandbox.stub(box3d, 'destroySubModules').callsFake(() => {});
box3d.handleContextLost();
expect(destroySubModules).to.be.called;
});
});

describe('handleContextRestored()', () => {
it('should call emit() with params ["progressstart"]', () => {
const emitStub = sandbox.stub(box3d, 'emit', (eventName) => {
const emitStub = sandbox.stub(box3d, 'emit').callsFake((eventName) => {
expect(eventName).to.equal('progressstart');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => {
action: ':D'
};

sandbox.stub(renderer, 'initBox3d', (options) => {
sandbox.stub(renderer, 'initBox3d').callsFake((options) => {
expect(options.sceneEntities).to.deep.equal(mySceneEntities);
done();
return new Promise(() => {});
Expand All @@ -172,7 +172,7 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => {
});

it('should use default sceneEntities, if none provided, for initialization', (done) => {
sandbox.stub(renderer, 'initBox3d', (options) => {
sandbox.stub(renderer, 'initBox3d').callsFake((options) => {
expect(options.sceneEntities).to.deep.equal(sceneEntities);
done();
return new Promise(() => {});
Expand All @@ -189,7 +189,7 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => {
middle_click: 'always'
};

sandbox.stub(renderer, 'initBox3d', (options) => {
sandbox.stub(renderer, 'initBox3d').callsFake((options) => {
expect(options.inputSettings).to.deep.equal(myInputSettings);
done();
return new Promise(() => {});
Expand All @@ -205,7 +205,7 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => {
even: { more: 'things' }
};

sandbox.stub(renderer, 'initBox3d', (options) => {
sandbox.stub(renderer, 'initBox3d').callsFake((options) => {
expect(options).to.deep.equal(myOptions);
done();
return new Promise(() => {});
Expand All @@ -218,7 +218,7 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => {
const fileUrl = 'I/am/a/url';

sandbox.stub(renderer, 'initBox3d').returns(Promise.resolve());
sandbox.stub(renderer, 'loadPanoramaFile', (url) => {
sandbox.stub(renderer, 'loadPanoramaFile').callsFake((url) => {
expect(url).to.equal(fileUrl);
done();
return new Promise(() => {});
Expand All @@ -230,7 +230,7 @@ describe('lib/viewers/box3d/image360/Image360Renderer', () => {
it('should call onSceneLoad() when done loading file', (done) => {
sandbox.stub(renderer, 'initBox3d').returns(Promise.resolve());
sandbox.stub(renderer, 'loadPanoramaFile').returns(Promise.resolve());
sandbox.stub(renderer, 'onSceneLoad', () => {
sandbox.stub(renderer, 'onSceneLoad').callsFake(() => {
done();
});

Expand Down
Loading