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

Chore: Rename viewers #29

Merged
merged 8 commits into from
Apr 5, 2017
4 changes: 2 additions & 2 deletions src/lib/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Logger from './Logger';
import loaderList from './loaders';
import cache from './Cache';
import ProgressBar from './ProgressBar';
import PreviewError from './viewers/error/PreviewError';
import PreviewErrorViewer from './viewers/error/PreviewErrorViewer';
import getTokens from './tokens';
import {
get,
Expand Down Expand Up @@ -1057,7 +1057,7 @@ class Preview extends EventEmitter {
* @return {PreviewError} PreviewError instance
*/
getErrorViewer() {
return new PreviewError(this.createViewerOptions({
return new PreviewErrorViewer(this.createViewerOptions({
viewer: { NAME: 'Error' },
container: this.container,
file: this.file
Expand Down
4 changes: 2 additions & 2 deletions src/lib/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TextLoader from './viewers/text/TextLoader';
import MediaLoader from './viewers/media/MediaLoader';
import Video360Loader from './viewers/box3d/video360/Video360Loader';
import DocLoader from './viewers/doc/DocLoader';
import Model3dLoader from './viewers/box3d/model3d/Model3dLoader';
import Model3DLoader from './viewers/box3d/model3d/Model3DLoader';
import IFrameLoader from './viewers/iframe/IFrameLoader';
import OfficeLoader from './viewers/office/OfficeLoader';

Expand All @@ -19,6 +19,6 @@ export default [
MediaLoader,
Image360Loader,
ImageLoader,
Model3dLoader,
Model3DLoader,
IFrameLoader
];
6 changes: 3 additions & 3 deletions src/lib/viewers/Base.js → src/lib/viewers/BaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const LOAD_TIMEOUT_MS = 180000; // 3m
const RESIZE_WAIT_TIME_IN_MILLIS = 300;

@autobind
class Base extends EventEmitter {
class BaseViewer extends EventEmitter {
/**
* [constructor]
*
* @param {HTMLElement} containerEl - The container
* @param {Object} options - some options
* @return {Base} Instance of base
* @return {BaseViewer} Instance of base viewer
*/
constructor(options) {
super();
Expand Down Expand Up @@ -480,4 +480,4 @@ class Base extends EventEmitter {
}
}

export default Base;
export default BaseViewer;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-unused-expressions */
import EventEmitter from 'events';
import Base from '../Base';
import BaseViewer from '../BaseViewer';
import Browser from '../../Browser';
import RepStatus from '../../RepStatus';
import fullscreen from '../../Fullscreen';
Expand All @@ -10,7 +10,7 @@ let base;
let containerEl;
const sandbox = sinon.sandbox.create();

describe('lib/viewers/Base', () => {
describe('lib/viewers/BaseViewer', () => {
before(() => {
fixture.setBase('src/lib');
});
Expand All @@ -19,7 +19,7 @@ describe('lib/viewers/Base', () => {
fixture.load('viewers/__tests__/Base-test.html');

containerEl = document.querySelector('.bp-container');
base = new Base({
base = new BaseViewer({
container: containerEl,
file: {
id: '0'
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('lib/viewers/Base', () => {
const sharedLinkPassword = 'pass';
const url = 'url';

base = new Base({
base = new BaseViewer({
token,
sharedLink,
sharedLinkPassword,
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('lib/viewers/Base', () => {
it('should return content url with asset path from args', () => {
const url = 'url{asset_path}';

base = new Base({
base = new BaseViewer({
viewer: { ASSET: 'foo' },
container: containerEl,
file: {
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('lib/viewers/Base', () => {
const sharedLinkPassword = 'pass';
const headers = {};

base = new Base({
base = new BaseViewer({
token,
sharedLink,
sharedLinkPassword,
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('lib/viewers/Base', () => {
const data = {};
const viewerName = 'name';

base = new Base({
base = new BaseViewer({
viewer: { NAME: viewerName },
file: {
id: fileId
Expand Down Expand Up @@ -319,7 +319,7 @@ describe('lib/viewers/Base', () => {
let event = {};

beforeEach(() => {
base = new Base({
base = new BaseViewer({
container: containerEl,
file: {
id: '123'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
EVENT_SCENE_LOADED,
EVENT_TOGGLE_FULLSCREEN,
EVENT_TOGGLE_VR
} from './Box3dConstants';
} from './box3DConstants';
import {
ICON_FULLSCREEN_IN,
ICON_FULLSCREEN_OUT,
ICON_3D_VR
} from '../../icons/icons';

import { CLASS_HIDDEN } from '../../constants';
import { UIRegistry } from './Box3dUiUtils';
import { UIRegistry } from './Box3DUIUtils';

@autobind
class Box3DControls extends EventEmitter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
EVENT_SHOW_VR_BUTTON,
EVENT_SCENE_LOADED,
EVENT_TRIGGER_RENDER
} from './Box3dConstants';
} from './box3DConstants';
import { MODEL3D_STATIC_ASSETS_VERSION } from '../../constants';

const PREVIEW_CAMERA_CONTROLLER_ID = 'orbit_camera';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
CSS_CLASS_SETTINGS_PANEL_LABEL,
CSS_CLASS_SETTINGS_PANEL_ROW,
CSS_CLASS_HIDDEN
} from './model3d/Model3dConstants';
} from './model3d/model3DConstants';

import {
CLASS_BOX_PREVIEW_BUTTON,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import autobind from 'autobind-decorator';
import Base from '../Base';
import BaseViewer from '../BaseViewer';
import fullscreen from '../../Fullscreen';
import Box3DControls from './Box3dControls';
import Box3DRenderer from './Box3dRenderer';
import Box3DControls from './Box3DControls';
import Box3DRenderer from './Box3DRenderer';
import Browser from '../../Browser';
import { get } from '../../util';
import {
Expand All @@ -14,22 +14,22 @@ import {
EVENT_SHOW_VR_BUTTON,
EVENT_TOGGLE_FULLSCREEN,
EVENT_TOGGLE_VR
} from './Box3dConstants';
import JS from './box3dAssets';
import './Box3d.scss';
} from './box3DConstants';
import JS from './box3DAssets';
import './Box3D.scss';

// Milliseconds to wait for model to load before cancelling Preview
const LOAD_TIMEOUT = 50000;

const CLASS_VR_ENABLED = 'vr-enabled';

/**
* Box3D
* Box3DViewer
* This is the entry point for Box3D Preview Base
* @class
*/
@autobind
class Box3D extends Base {
class Box3DViewer extends BaseViewer {
/**
* @inheritdoc
*/
Expand Down Expand Up @@ -290,4 +290,4 @@ class Box3D extends Base {
}
}

export default Box3D;
export default Box3DViewer;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-unused-expressions */
import Box3DControls from '../Box3dControls';
import Box3DControls from '../Box3DControls';
import Controls from '../../../Controls';
import { UIRegistry } from '../Box3dUiUtils';
import { UIRegistry } from '../Box3DUIUtils';
import { CLASS_HIDDEN } from '../../../constants';
import {
ICON_FULLSCREEN_IN,
Expand All @@ -13,20 +13,20 @@ import {
EVENT_SCENE_LOADED,
EVENT_TOGGLE_FULLSCREEN,
EVENT_TOGGLE_VR
} from '../Box3dConstants';
} from '../box3DConstants';

const sandbox = sinon.sandbox.create();

let containerEl;
let controls;

describe('lib/viewers/box3d/Box3dControls', () => {
describe('lib/viewers/box3d/Box3DControls', () => {
before(() => {
fixture.setBase('src/lib');
});

beforeEach(() => {
fixture.load('viewers/box3d/__tests__/Box3dControls-test.html');
fixture.load('viewers/box3d/__tests__/Box3DControls-test.html');
containerEl = document.querySelector('.container');
controls = new Box3DControls(containerEl);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global Box3D */
/* eslint-disable no-unused-expressions */
import Box3DRenderer from '../Box3dRenderer';
import { EVENT_SHOW_VR_BUTTON } from '../Box3dConstants';
import Box3DRenderer from '../Box3DRenderer';
import { EVENT_SHOW_VR_BUTTON } from '../box3DConstants';

const sandbox = sinon.sandbox.create();
const PREVIEW_CAMERA_CONTROLLER_ID = 'orbit_camera';
Expand All @@ -10,13 +10,13 @@ let containerEl;
let renderer;
let stubs = {};

describe('lib/viewers/box3d/Box3dRenderer', () => {
describe('lib/viewers/box3d/Box3DRenderer', () => {
before(() => {
fixture.setBase('src/lib');
});

beforeEach(() => {
fixture.load('viewers/box3d/__tests__/Box3dRenderer-test.html');
fixture.load('viewers/box3d/__tests__/Box3DRenderer-test.html');
stubs.THREE = sandbox.stub(window, 'THREE');
containerEl = document.querySelector('.container');
renderer = new Box3DRenderer(containerEl, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {
createPullup,
createRow,
UIRegistry
} from '../Box3dUiUtils';
} from '../Box3DUIUtils';

import {
CSS_CLASS_OVERLAY,
CSS_CLASS_PULLUP,
CSS_CLASS_SETTINGS_PANEL_LABEL,
CSS_CLASS_SETTINGS_PANEL_ROW,
CSS_CLASS_HIDDEN
} from '../model3d/Model3dConstants';
} from '../model3d/model3DConstants';


import {
Expand All @@ -31,13 +31,13 @@ const sandbox = sinon.sandbox.create();

let containerEl;

describe('lib/viewers/box3d/Box3dUiUtils', () => {
describe('lib/viewers/box3d/Box3DUIUtils', () => {
before(() => {
fixture.setBase('src/lib');
});

beforeEach(() => {
fixture.load('viewers/box3d/__tests__/Box3dUiUtils-test.html');
fixture.load('viewers/box3d/__tests__/Box3DUIUtils-test.html');
containerEl = document.querySelector('.container');
});

Expand Down
Loading