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

Fix: Print poup and buffering DOM references #980

Merged
merged 4 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 16 additions & 14 deletions src/lib/viewers/media/_mediaBase.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,25 @@

// When media is buffering, show only the crawler
.bp {
&.bp-loaded .bp-is-buffering .bp-loading-wrapper,
.bp-is-buffering .bp-loading-wrapper {
// Show loading indicator immediately
animation-name: none;
display: flex;
&,
&.bp-loaded {
.bp-is-buffering .bp-loading-wrapper {
// Show loading indicator immediately
animation-name: none;
display: flex;

.bp-icon,
.bp-loading-text,
.bp-loading-btn-container {
display: none;
}
.bp-icon,
.bp-loading-text,
.bp-loading-btn-container {
display: none;
}

.bp-crawler-wrapper {
position: static;
.bp-crawler-wrapper {
position: static;

.bp-crawler div {
background-color: $box-blue;
.bp-crawler div {
background-color: $box-blue;
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/lib/viewers/office/__tests__/OfficeViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BaseViewer from '../../BaseViewer';
import Browser from '../../../Browser';
import Location from '../../../Location';
import OfficeViewer from '../OfficeViewer';
import { CLASS_HIDDEN } from '../../../constants';
import { CLASS_HIDDEN, SELECTOR_BOX_PREVIEW } from '../../../constants';
import { ICON_PRINT_CHECKMARK } from '../../../icons/icons';

const PRINT_TIMEOUT_MS = 1000; // Wait 1s before trying to print
Expand All @@ -16,6 +16,7 @@ const sandbox = sinon.sandbox.create();
let office;
let stubs = {};
let containerEl;
let rootEl;

describe('lib/viewers/office/OfficeViewer', () => {
let clock;
Expand All @@ -28,6 +29,7 @@ describe('lib/viewers/office/OfficeViewer', () => {
beforeEach(() => {
fixture.load('viewers/office/__tests__/OfficeViewer-test.html');
containerEl = document.querySelector('.container');
rootEl = document.querySelector(SELECTOR_BOX_PREVIEW);
office = new OfficeViewer({
container: containerEl,
file: {
Expand All @@ -51,6 +53,7 @@ describe('lib/viewers/office/OfficeViewer', () => {
clock = sinon.useFakeTimers();
Object.defineProperty(BaseViewer.prototype, 'setup', { value: sandbox.stub() });
office.containerEl = containerEl;
office.rootEl = rootEl;
});

afterEach(() => {
Expand Down
5 changes: 4 additions & 1 deletion src/lib/viewers/text/__tests__/MarkdownViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import MarkdownViewer from '../MarkdownViewer';
import BaseViewer from '../../BaseViewer';
import Popup from '../../../Popup';
import { TEXT_STATIC_ASSETS_VERSION } from '../../../constants';
import { TEXT_STATIC_ASSETS_VERSION, SELECTOR_BOX_PREVIEW } from '../../../constants';
import { VIEWER_EVENT } from '../../../events';

let containerEl;
let markdown;
const sandbox = sinon.sandbox.create();
let rootEl;
ConradJChan marked this conversation as resolved.
Show resolved Hide resolved

describe('lib/viewers/text/MarkdownViewer', () => {
const setupFunc = BaseViewer.prototype.setup;
Expand All @@ -19,6 +20,7 @@ describe('lib/viewers/text/MarkdownViewer', () => {
beforeEach(() => {
fixture.load('viewers/text/__tests__/MarkdownViewer-test.html');
containerEl = document.querySelector('.container');
rootEl = document.querySelector(SELECTOR_BOX_PREVIEW);
markdown = new MarkdownViewer({
file: {
id: 0
Expand All @@ -28,6 +30,7 @@ describe('lib/viewers/text/MarkdownViewer', () => {

Object.defineProperty(BaseViewer.prototype, 'setup', { value: sandbox.mock() });
markdown.containerEl = containerEl;
markdown.rootEl = rootEl;
markdown.setup();
});

Expand Down
6 changes: 5 additions & 1 deletion src/lib/viewers/text/__tests__/PlainTextViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import BaseViewer from '../../BaseViewer';
import Popup from '../../../Popup';
import TextBaseViewer from '../TextBaseViewer';
import * as util from '../../../util';
import { TEXT_STATIC_ASSETS_VERSION } from '../../../constants';
import { TEXT_STATIC_ASSETS_VERSION, SELECTOR_BOX_PREVIEW } from '../../../constants';
import { VIEWER_EVENT } from '../../../events';

let containerEl;
let text;
const sandbox = sinon.sandbox.create();
let rootEl;

describe('lib/viewers/text/PlainTextViewer', () => {
const setupFunc = BaseViewer.prototype.setup;
Expand All @@ -23,6 +24,7 @@ describe('lib/viewers/text/PlainTextViewer', () => {
beforeEach(() => {
fixture.load('viewers/text/__tests__/PlainTextViewer-test.html');
containerEl = document.querySelector('.container');
rootEl = document.querySelector(SELECTOR_BOX_PREVIEW);
text = new PlainTextViewer({
file: {
id: 0,
Expand All @@ -40,6 +42,7 @@ describe('lib/viewers/text/PlainTextViewer', () => {

Object.defineProperty(BaseViewer.prototype, 'setup', { value: sandbox.stub() });
text.containerEl = containerEl;
text.rootEl = rootEl;
text.setup();
});

Expand Down Expand Up @@ -304,6 +307,7 @@ describe('lib/viewers/text/PlainTextViewer', () => {
});
Object.defineProperty(BaseViewer.prototype, 'setup', { value: sandbox.stub() });
text.containerEl = containerEl;
text.rootEl = rootEl;
text.setup();
});

Expand Down