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

Upgrade: packages #813

Merged
merged 2 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@
"object": true,
"array": false
}
],
"react/button-has-type": [
"off"
],
"no-else-return": [
"error",
{
"allowElseIf": true
}
],
"import/no-cycle": [
"off"
]
},
"settings": {
Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"url": "git@github.com:box/box-content-preview.git"
},
"devDependencies": {
"@commitlint/cli": "^5.2.0",
"autoprefixer": "^7.2.1",
"@commitlint/cli": "^7.0.0",
"autoprefixer": "^8.6.3",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-loader": "^7.1.2",
Expand All @@ -25,20 +25,20 @@
"babel-preset-react": "^6.23.0",
"box-annotations": "^2.2.0",
"box-locales": "^0.0.1",
"box-react-ui": "^22.7.0",
"box-react-ui": "^23.5.0",
"chai": "^4.1.2",
"chai-dom": "^1.5.0",
"codeceptjs": "^1.1.8",
"conventional-changelog-cli": "^1.3.5",
"conventional-github-releaser": "^2.0.0",
"conventional-changelog-cli": "^2.0.1",
"conventional-github-releaser": "^3.1.2",
"create-react-class": "^15.6.2",
"css-loader": "^0.28.7",
"cssnano-cli": "^1.0.5",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.1",
"eslint-import-resolver-webpack": "^0.10.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
Expand All @@ -50,7 +50,7 @@
"husky": "^0.14.3",
"i18n-webpack-plugin": "^1.0.0",
"jsuri": "^1.3.1",
"karma": "^1.5.0",
"karma": "^2.0.4",
"karma-chai": "^0.1.0",
"karma-chai-dom": "^1.1.0",
"karma-chrome-launcher": "^2.2.0",
Expand All @@ -64,16 +64,16 @@
"karma-sinon": "^1.0.5",
"karma-sinon-chai": "^1.3.3",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.6",
"lint-staged": "^5.0.0",
"karma-webpack": "^3.0.0",
"lint-staged": "^7.2.0",
"lodash": "^4.17.5",
"mocha": "^4.0.1",
"mocha": "^5.2.0",
"mock-local-storage": "^1.0.2",
"mojito-rb-gen": "^0.0.1",
"node-noop": "^1.0.0",
"node-sass": "^4.7.2",
"nsp": "^3.2.1",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"optimize-css-assets-webpack-plugin": "^4.0.2",
"phantomjs-prebuilt": "^2.1.16",
"postcss-loader": "^2.0.9",
"postcss-sass": "^0.3.0",
Expand All @@ -83,17 +83,17 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-virtualized": "^9.13.0",
"sass-loader": "^6.0.6",
"sass-loader": "^7.0.3",
"saucelabs": "^1.4.0",
"selenium-webdriver": "^3.6.0",
"sinon": "^4.1.2",
"sinon-chai": "2.14.0",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.19.0",
"stylelint": "^8.3.1",
"selenium-webdriver": "^4.0.0-alpha.1",
"sinon": "^6.0.0",
"sinon-chai": "3.2.0",
"string-replace-loader": "^2.1.1",
"style-loader": "^0.21.0",
"stylelint": "^9.3.0",
"stylelint-config-standard": "^18.0.0",
"stylelint-order": "^0.7.0",
"stylelint-scss": "^2.2.0",
"stylelint-order": "^0.8.1",
"stylelint-scss": "^3.1.3",
"webdriverio": "^4.12.0",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
Expand Down
1 change: 1 addition & 0 deletions src/lib/PageControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PageControls extends EventEmitter {

/** @property {HTMLElement} - Page number input element */
pageNumInputEl;

/**
* [constructor]
*
Expand Down
2 changes: 1 addition & 1 deletion src/lib/__tests__/Controls-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-unused-expressions */
import Controls from '../Controls';
import { CLASS_HIDDEN } from './../constants';
import { CLASS_HIDDEN } from '../constants';

let controls;
let clock;
Expand Down
1 change: 1 addition & 0 deletions src/lib/__tests__/DownloadReachability-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ describe('lib/DownloadReachability', () => {
afterEach(() => {
fetchMock.restore();
});

it('should catch an errored response', () => {
const setDownloadHostFallbackStub = sandbox.stub(DownloadReachability, 'setDownloadHostFallback');
fetchMock.head('https://dl3.boxcloud.com', { throws: new Error() });
Expand Down
2 changes: 0 additions & 2 deletions src/lib/__tests__/Preview-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable no-unused-expressions */
import fetchMock from 'fetch-mock';
import Preview from '../Preview';
import loaders from '../loaders';
import Logger from '../Logger';
Expand Down Expand Up @@ -40,7 +39,6 @@ describe('lib/Preview', () => {
afterEach(() => {
sandbox.verifyAndRestore();
fixture.cleanup();
fetchMock.restore();
preview.destroy();
preview = null;
stubs = null;
Expand Down
39 changes: 26 additions & 13 deletions src/lib/viewers/doc/__tests__/DocPreloader-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('lib/viewers/doc/DocPreloader', () => {

it('should clean up preload after transition ends', () => {
docPreloader.wrapperEl = document.createElement('div');
sandbox.stub()
sandbox.stub();

docPreloader.hidePreload();
docPreloader.wrapperEl.dispatchEvent(new Event('transitionend'));
Expand All @@ -151,7 +151,7 @@ describe('lib/viewers/doc/DocPreloader', () => {

it('should clean up preload after scroll event', () => {
docPreloader.wrapperEl = document.createElement('div');
sandbox.stub()
sandbox.stub();

docPreloader.hidePreload();
docPreloader.wrapperEl.dispatchEvent(new Event('scroll'));
Expand All @@ -162,19 +162,26 @@ describe('lib/viewers/doc/DocPreloader', () => {

describe('cleanupPreload()', () => {
it('should remove wrapper, clear out preload and image element, and revoke object URL', () => {
docPreloader.wrapperEl = document.createElement('div');
const removeChildStub = sandbox.stub();

docPreloader.wrapperEl = {
parentNode: {
removeChild: removeChildStub
}
};
docPreloader.preloadEl = document.createElement('div');
docPreloader.imageEl = document.createElement('img');
docPreloader.srcUrl = 'blah';
containerEl.appendChild(docPreloader.wrapperEl);

sandbox.mock(URL).expects('revokeObjectURL').withArgs(docPreloader.srcUrl);
sandbox
.mock(URL)
.expects('revokeObjectURL')
.withArgs(docPreloader.srcUrl);

docPreloader.cleanupPreload();

expect(docPreloader.preloadEl).to.be.undefined;
expect(docPreloader.imageEl).to.be.undefined;
expect(containerEl).to.not.contain(docPreloader.wrapperEl);
expect(removeChildStub).to.be.called;
});
});

Expand Down Expand Up @@ -421,7 +428,8 @@ describe('lib/viewers/doc/DocPreloader', () => {
},
getTag: sandbox.stub().returns('')
};
docPreloader.readEXIF(fakeImageEl)
docPreloader
.readEXIF(fakeImageEl)
.then(() => Assert.fail())
.catch((err) => {
expect(err).to.be.an('error');
Expand All @@ -430,7 +438,8 @@ describe('lib/viewers/doc/DocPreloader', () => {

it('should return a promise that eventually rejects if EXIF parser is not available', () => {
window.EXIF = null;
return docPreloader.readEXIF(fakeImageEl)
return docPreloader
.readEXIF(fakeImageEl)
.then(() => Assert.fail())
.catch((err) => {
expect(err).to.be.an('error');
Expand All @@ -452,7 +461,8 @@ describe('lib/viewers/doc/DocPreloader', () => {
getTag: sandbox.stub().returns(exifRawArray)
};

return docPreloader.readEXIF(fakeImageEl)
return docPreloader
.readEXIF(fakeImageEl)
.then(() => Assert.fail())
.catch((err) => {
expect(err).to.be.an('error');
Expand All @@ -474,7 +484,8 @@ describe('lib/viewers/doc/DocPreloader', () => {
getTag: sandbox.stub().returns(exifRawArray)
};

return docPreloader.readEXIF(fakeImageEl)
return docPreloader
.readEXIF(fakeImageEl)
.then(() => Assert.fail())
.catch((err) => {
expect(err).to.be.an('error');
Expand All @@ -496,7 +507,8 @@ describe('lib/viewers/doc/DocPreloader', () => {
getTag: sandbox.stub().returns(exifRawArray)
};

return docPreloader.readEXIF(fakeImageEl)
return docPreloader
.readEXIF(fakeImageEl)
.then((response) => {
response.should.deep.equal({
pdfWidth: pdfWidth * PDFJS_CSS_UNITS,
Expand All @@ -522,7 +534,8 @@ describe('lib/viewers/doc/DocPreloader', () => {
getTag: sandbox.stub().returns(exifRawArray)
};

return docPreloader.readEXIF(fakeImageEl)
return docPreloader
.readEXIF(fakeImageEl)
.then((response) => {
response.should.deep.equal({
pdfWidth: pdfHeight * PDFJS_CSS_UNITS,
Expand Down
1 change: 1 addition & 0 deletions src/lib/viewers/media/MediaBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class MediaBaseViewer extends BaseViewer {
this.handleAutoplay = this.handleAutoplay.bind(this);
this.mediaendHandler = this.mediaendHandler.bind(this);
}

/**
* @inheritdoc
*/
Expand Down
4 changes: 2 additions & 2 deletions src/lib/viewers/text/BoxCSV.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class BoxCSV {
return row % 2 === 0 ? 'bp-text-csv-even-row' : 'bp-text-csv-odd-row';
}

/* eslint-disable react/prop-types */
/* eslint-disable */
/**
* Renders cell
*
Expand All @@ -63,7 +63,7 @@ class BoxCSV {
</div>
);
};
/* eslint-enable react/prop-types */
/* eslint-enable */

/**
* Renders CSV into an html table
Expand Down
1 change: 1 addition & 0 deletions src/lib/viewers/text/TextBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class TextBaseViewer extends BaseViewer {
this.zoomOut = this.zoomOut.bind(this);
this.zoomIn = this.zoomIn.bind(this);
}

/**
* @inheritdoc
*/
Expand Down
Loading