Added tests for jQuery.

This commit is contained in:
Uwe Oestermeier 2019-07-16 10:04:25 +02:00
parent 09b50d3b81
commit 1f5df65c48
3 changed files with 33 additions and 25 deletions

16
dist/iwmlib.js vendored
View File

@ -9328,7 +9328,9 @@
} }
//jquery hyphenate below //jquery hyphenate below
if (typeof($) != 'undefined') {
$('.column').not('.overview').children('p').hyphenate('de'); $('.column').not('.overview').children('p').hyphenate('de');
}
//logging //logging
if (src) { if (src) {
@ -9820,9 +9822,11 @@
this._setPopupSource(popup, source); this._setPopupSource(popup, source);
context.popup = popup; context.popup = popup;
if (typeof($) != 'undefined') {
//jquery hyphenate below //jquery hyphenate below
console.log('hyphenated popup:', $('span').hyphenate('de')); console.log('hyphenated popup:', $('span').hyphenate('de'));
} }
}
static _unsetPopup(context) { static _unsetPopup(context) {
context.popup = null; context.popup = null;
@ -9944,10 +9948,6 @@
zoomable: 0.5 zoomable: 0.5
}; };
/** Make the class available in the global namespace */
window.Card = Card;
/** /**
* Extends the card with scatter functionality. * Extends the card with scatter functionality.
* *
@ -10053,13 +10053,16 @@
*/ */
static loadAndCreateScatterCard(scatterContainer, item, { static loadAndCreateScatterCard(scatterContainer, item, {
basePath = "../", basePath = "../",
modules = null, modules = [],
onClose = null onClose = null
} = {}) { } = {}) {
console.log(basePath); console.log(basePath);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.loadHTML(basePath + "/" + item + "/index.html") let url = basePath + "/" + item + "/index.html";
console.log("Loading", url);
this.loadHTML(url)
.then(html => { .then(html => {
console.log("Received", html);
let element = this.createCardScatter(html, scatterContainer, { let element = this.createCardScatter(html, scatterContainer, {
basePath, basePath,
modules modules
@ -10205,6 +10208,7 @@
window.CardWrapper = CardWrapper; window.CardWrapper = CardWrapper;
window.Card = Card; window.Card = Card;
window.ScatterCard = ScatterCard;
window.Highlight = Highlight$1; window.Highlight = Highlight$1;
window.Theme = Theme; window.Theme = Theme;

View File

@ -21,7 +21,7 @@ import UITest from './uitest.js'
import CardWrapper from './card/wrapper.js' import CardWrapper from './card/wrapper.js'
import Highlight from './card/highlight.js' import Highlight from './card/highlight.js'
import Card from './card/card.js' import {Card, ScatterCard} from './card/card.js'
import Theme from './card/theme.js' import Theme from './card/theme.js'
/* Needed to ensure that rollup.js includes class definitions and the classes /* Needed to ensure that rollup.js includes class definitions and the classes
@ -90,5 +90,6 @@ window.randomFloat = randomFloat
window.CardWrapper = CardWrapper window.CardWrapper = CardWrapper
window.Card = Card window.Card = Card
window.ScatterCard = ScatterCard
window.Highlight = Highlight window.Highlight = Highlight
window.Theme = Theme window.Theme = Theme

View File

@ -29,7 +29,7 @@ const enableNearestNeighborTaps = false
* *
* The class is used as a namespace and should never called with new. * The class is used as a namespace and should never called with new.
*/ */
export default class Card { export class Card {
static setup(context, modules = []) { static setup(context, modules = []) {
console.log("Setup Card...", modules) console.log("Setup Card...", modules)
@ -1253,7 +1253,9 @@ export default class Card {
} }
//jquery hyphenate below //jquery hyphenate below
if (typeof($) != 'undefined') {
$('.column').not('.overview').children('p').hyphenate('de') $('.column').not('.overview').children('p').hyphenate('de')
}
//logging //logging
if (src) { if (src) {
@ -1755,9 +1757,11 @@ export default class Card {
this._setPopupSource(popup, source) this._setPopupSource(popup, source)
context.popup = popup context.popup = popup
if (typeof($) != 'undefined') {
//jquery hyphenate below //jquery hyphenate below
console.log('hyphenated popup:', $('span').hyphenate('de')) console.log('hyphenated popup:', $('span').hyphenate('de'))
} }
}
static _unsetPopup(context) { static _unsetPopup(context) {
context.popup = null context.popup = null
@ -1879,16 +1883,12 @@ Card.animation = {
zoomable: 0.5 zoomable: 0.5
} }
/** Make the class available in the global namespace */
window.Card = Card
/** /**
* Extends the card with scatter functionality. * Extends the card with scatter functionality.
* *
* @class ScatterCard * @class ScatterCard
*/ */
class ScatterCard extends Card { export class ScatterCard extends Card {
/** /**
@ -1988,13 +1988,16 @@ class ScatterCard extends Card {
*/ */
static loadAndCreateScatterCard(scatterContainer, item, { static loadAndCreateScatterCard(scatterContainer, item, {
basePath = "../", basePath = "../",
modules = null, modules = [],
onClose = null onClose = null
} = {}) { } = {}) {
console.log(basePath) console.log(basePath)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.loadHTML(basePath + "/" + item + "/index.html") let url = basePath + "/" + item + "/index.html"
console.log("Loading", url)
this.loadHTML(url)
.then(html => { .then(html => {
console.log("Received", html)
let element = this.createCardScatter(html, scatterContainer, { let element = this.createCardScatter(html, scatterContainer, {
basePath, basePath,
modules modules