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 core Tests #91

Merged
merged 8 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 7 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: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Clappr is under development but production-ready. Feel free to open issues and s
<p>
<a href="https://badge.fury.io/js/%40clappr%2Fcore"><img src="https://badge.fury.io/js/%40clappr%2Fcore.svg"></a>
<a href="https://bundlephobia.com/result?p=@clappr/core@latest"><img src="https://img.shields.io/bundlephobia/min/@clappr/core"></a>
<a href="https://travis-ci.org/clappr/clappr-core"><img src="https://travis-ci.org/clappr/clappr-core.svg?branch=master"></a>
<a href="https://coveralls.io/github/clappr/clappr-core?branch=master"><img src="https://coveralls.io/repos/github/clappr/clappr-core/badge.svg?branch=master"></a>
<a href="https://github.com/clappr/clappr-core/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-BSD--3--Clause-blue.svg"></a>
</p>
Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
"test": "jest /src --coverage --silent",
"test:coverage": "open coverage/lcov-report/index.html",
"test:debug": "node --inspect node_modules/.bin/jest src/ --runInBand",
"test:watch": "NODE_ENV=test karma start --no-single-run --watch",
"test:watch": "jest /src --watch",
"lint": "eslint *.js src/",
"lint:fix": "npm run lint -- --fix",
"start": "DEV=true rollup --config --watch",
"commitzen": "git-cz"
},
"engines": {
"node": "^v14.0.0"
},
"files": [
"/dist",
"/src"
Expand Down Expand Up @@ -71,12 +74,5 @@
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"nyc": {
"exclude": [
"**/*.test.js",
"**/*.spec.js",
"node_modules"
]
}
}
19 changes: 8 additions & 11 deletions src/components/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.

import { isNumber, Fullscreen, DomRecycler } from '@/utils'

import Styler from '@/base/styler'
import Events from '@/base/events'
import UIObject from '@/base/ui_object'
Expand All @@ -12,9 +11,7 @@ import Browser from '@/components/browser'
import ContainerFactory from '@/components/container_factory'
import PlayerError from '@/components/error'
import ErrorMixin from '@/base/error_mixin'

import $ from 'clappr-zepto'

import CoreStyle from './public/style.scss'
import ResetStyle from './public/optional_reset.scss'

Expand Down Expand Up @@ -109,7 +106,8 @@ export default class Core extends UIObject {
* @type {Object}
*/
get activePlaybackEl() {
return this.activePlayback.$el.find('video')[0] || this.activePlayback.el
if (!this.activePlayback) return undefined
return this.activePlayback.$el ? this.activePlayback.$el.find('video')[0] : this.activePlayback.el
}

constructor(options) {
Expand Down Expand Up @@ -166,7 +164,7 @@ export default class Core extends UIObject {
}

resize(options) {
if (!isNumber(options.height) && !isNumber(options.width)) {
if (!isNumber(options.height) && !isNumber(options.width)) {
this.el.style.height = `${options.height}`
this.el.style.width = `${options.width}`
} else {
Expand Down Expand Up @@ -314,13 +312,12 @@ export default class Core extends UIObject {
}

isFullscreen() {
// Ensure current instance is in fullscreen mode by checking fullscreen element
const fullscreenElement = Fullscreen.fullscreenElement()
const isElementInFullscreen = fullscreenElement && ((fullscreenElement === this.el)
|| (fullscreenElement === this.activePlaybackEl))
|| this.activePlaybackEl.webkitDisplayingFullscreen

return isElementInFullscreen

return fullscreenElement && (fullscreenElement === this.el)
|| fullscreenElement && (fullscreenElement === this.activePlaybackEl)
|| this.activePlaybackEl && this.activePlaybackEl.webkitDisplayingFullscreen
|| false
}

toggleFullscreen() {
Expand Down
Loading