bookingsync-calendar-widget
Advanced tools
Comparing version
{ | ||
"name": "bookingsync-calendar-widget", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "BookingSync Calendar Widget", | ||
@@ -5,0 +5,0 @@ "main": "dist/bookingsync-calendar-widget.js", |
@@ -558,3 +558,3 @@ /* global VERSION, Node, NODE_ENV, CSS_PREFIX, document, require */ | ||
// open tag <tr> | ||
week.push(rowTemplate.open); | ||
week.push(rowTemplate(i).open); | ||
@@ -605,3 +605,3 @@ // push days in week | ||
// close tag </tr> of week | ||
week.push(rowTemplate.close); | ||
week.push(rowTemplate().close); | ||
// push completed week to month template | ||
@@ -608,0 +608,0 @@ monthTpl.push(week.join('')); |
@@ -15,3 +15,3 @@ /* global NODE_ENV, Date */ | ||
startOfWeek: 0, // 0 Mo ... 6 Su, by ISO | ||
startOfWeek: 0, // 0 Su 1 Mo....6 Sa | ||
minStay: 1, // can select one night | ||
@@ -18,0 +18,0 @@ monthStart: currDate.getUTCMonth(), // start with current month by default M '0...12' |
@@ -44,3 +44,9 @@ import s from './styles/calendar.scss'; | ||
export const weekRow = { open: '<tr>', close: '</tr>' }; | ||
/* eslint arrow-body-style: 0 */ | ||
export const weekRow = (num) => { | ||
return { | ||
open: `<tr class="js-body-row-${num}">`, | ||
close: '</tr>', | ||
}; | ||
}; | ||
@@ -47,0 +53,0 @@ export const loading = `<div class="${s.loadingLayer}"> |
/* global describe, module, it, before, after, document, xit, beforeEach, afterEach */ | ||
import chai from 'chai'; | ||
import { destroyElement } from 'widget-utils'; | ||
@@ -26,9 +27,12 @@ import { mCell, calendar } from '../../src/styles/calendar.scss'; | ||
const div2 = stubElement('div', { 'data-bookingsync-calendar-widget': true }); | ||
describe('BookingSync Calendar renders on containers with auto-init', () => { | ||
before(() => { | ||
document.body.appendChild(div1); | ||
document.body.appendChild(div2); | ||
}); | ||
document.body.appendChild(div1); | ||
document.body.appendChild(div2); | ||
describe('BookingSync Calendar renders on containers with auto-init', () => { | ||
after(() => { | ||
BookingSyncCalendar.instances.map(a => a.destroy()); | ||
destroyElement(div1); | ||
destroyElement(div2); | ||
}); | ||
@@ -35,0 +39,0 @@ |
@@ -18,3 +18,3 @@ /* global describe, module, it, before, after, document, xit */ | ||
describe('sense checks', () => { | ||
describe.only('sense checks', () => { | ||
let widget; | ||
@@ -25,8 +25,23 @@ let rootElement; | ||
rootElement = stubElement('div'); | ||
widget = new Calendar({ el: rootElement }); | ||
document.body.appendChild(rootElement); | ||
widget = new Calendar({ | ||
el: rootElement, | ||
monthStart: 2, | ||
displayMonths: 1, | ||
yearStart: 2017, | ||
}); | ||
}); | ||
after(() => { | ||
widget.destroy(); | ||
}); | ||
it('renders', () => { | ||
expect(widget.el).to.be.deep.equal(rootElement); | ||
}); | ||
it('renders 3 empty days in February 2017, 01/02/2017 is We', () => { | ||
expect(document.querySelectorAll('.js-body-row-0 td:empty').length).to.be.deep.equal(3); | ||
}); | ||
}); |
346478
0.17%1672
1.39%