Added tests for jQuery.
This commit is contained in:
+2
-1
@@ -21,7 +21,7 @@ import UITest from './uitest.js'
|
||||
|
||||
import CardWrapper from './card/wrapper.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'
|
||||
|
||||
/* Needed to ensure that rollup.js includes class definitions and the classes
|
||||
@@ -90,5 +90,6 @@ window.randomFloat = randomFloat
|
||||
|
||||
window.CardWrapper = CardWrapper
|
||||
window.Card = Card
|
||||
window.ScatterCard = ScatterCard
|
||||
window.Highlight = Highlight
|
||||
window.Theme = Theme
|
||||
|
||||
+16
-13
@@ -29,7 +29,7 @@ const enableNearestNeighborTaps = false
|
||||
*
|
||||
* The class is used as a namespace and should never called with new.
|
||||
*/
|
||||
export default class Card {
|
||||
export class Card {
|
||||
|
||||
static setup(context, modules = []) {
|
||||
console.log("Setup Card...", modules)
|
||||
@@ -1253,7 +1253,9 @@ export default class Card {
|
||||
}
|
||||
|
||||
//jquery hyphenate below
|
||||
$('.column').not('.overview').children('p').hyphenate('de')
|
||||
if (typeof($) != 'undefined') {
|
||||
$('.column').not('.overview').children('p').hyphenate('de')
|
||||
}
|
||||
|
||||
//logging
|
||||
if (src) {
|
||||
@@ -1699,7 +1701,7 @@ export default class Card {
|
||||
let linkRects = links.map(link => {
|
||||
let rect = link.getBoundingClientRect()
|
||||
let topLeft = Points.fromPageToNode(indexbox, rect)
|
||||
let center = Points.fromPageToNode(indexbox, {x: rect.x + rect.width/2, y: rect.y + rect.height/2})
|
||||
let center = Points.fromPageToNode(indexbox, { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 })
|
||||
return { x: topLeft.x, y: topLeft.y, width: rect.width, height: rect.height, center, link }
|
||||
})
|
||||
|
||||
@@ -1726,7 +1728,7 @@ export default class Card {
|
||||
let local = Points.fromPageToNode(context, globalClick)
|
||||
let rect = linkRects[closestLinkIndex]
|
||||
local.y = rect.center.y
|
||||
|
||||
|
||||
Card.loadPopup(event, context, closestLink, local)
|
||||
}
|
||||
}
|
||||
@@ -1755,8 +1757,10 @@ export default class Card {
|
||||
this._setPopupSource(popup, source)
|
||||
context.popup = popup
|
||||
|
||||
//jquery hyphenate below
|
||||
console.log('hyphenated popup:', $('span').hyphenate('de'))
|
||||
if (typeof($) != 'undefined') {
|
||||
//jquery hyphenate below
|
||||
console.log('hyphenated popup:', $('span').hyphenate('de'))
|
||||
}
|
||||
}
|
||||
|
||||
static _unsetPopup(context) {
|
||||
@@ -1879,16 +1883,12 @@ Card.animation = {
|
||||
zoomable: 0.5
|
||||
}
|
||||
|
||||
|
||||
/** Make the class available in the global namespace */
|
||||
window.Card = Card
|
||||
|
||||
/**
|
||||
* Extends the card with scatter functionality.
|
||||
*
|
||||
* @class ScatterCard
|
||||
*/
|
||||
class ScatterCard extends Card {
|
||||
export class ScatterCard extends Card {
|
||||
|
||||
|
||||
/**
|
||||
@@ -1988,13 +1988,16 @@ class ScatterCard extends Card {
|
||||
*/
|
||||
static loadAndCreateScatterCard(scatterContainer, item, {
|
||||
basePath = "../",
|
||||
modules = null,
|
||||
modules = [],
|
||||
onClose = null
|
||||
} = {}) {
|
||||
console.log(basePath)
|
||||
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 => {
|
||||
console.log("Received", html)
|
||||
let element = this.createCardScatter(html, scatterContainer, {
|
||||
basePath,
|
||||
modules
|
||||
|
||||
Reference in New Issue
Block a user