Last active
December 10, 2015 11:08
-
-
Save yurenju/4425319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsdom = require('jsdom').jsdom; | |
var assert = require('chai').assert; | |
var html = require('fs').readFileSync('index.html').toString(); | |
var window, document, Weather; | |
suite('Weather', function() { | |
setup(function() { | |
document = jsdom(html); | |
window = document.createWindow(); | |
Weather = require(__dirname + '/../js/weather.js').Weather; | |
Weather.init(window, document); | |
}); | |
test('getAllElements', function() { | |
assert.equal('temp-graph', Weather.tempGraph.id); | |
assert.equal('current-temp', Weather.currentTemp.parentNode.id); | |
assert.equal('high-temp-0', Weather['maxTemp0'].id); | |
}); | |
test('updateWeekday', function() { | |
//2013/1/1 is Tuesday | |
Weather.updateWeekday(new Date('Jan 01, 2013')); | |
assert.equal(Weather.day0.textContent, 'T', 'day0 is [T]uesday'); | |
assert.equal(Weather.day4.textContent, 'S', 'day4 is [S]aturday'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment