gardr-plugin-host-wallpaper
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -9,3 +9,3 @@ var eventlistener = require('eventlistener'); | ||
if (item.rendered.wallpaperimage) { | ||
createWallpaperByUrl(item.rendered.wallpaperimage, item.rendered.wallpapercolor); | ||
createWallpaperByUrl(item.rendered.wallpaperimage, item.rendered.wallpapertiling, item.rendered.wallpapercolor); | ||
if (item.rendered.wallpaperclick) { | ||
@@ -20,4 +20,5 @@ listenToBodyClicks(item.rendered.wallpaperclick); | ||
function createWallpaperByUrl (url, color) { | ||
var css = 'url(' + url + ') 0% 0% repeat fixed ' + (color || ''); | ||
function createWallpaperByUrl (url, tiling, color) { | ||
var repeat = (tiling === 'yes' || tiling === 'true') ? 'repeat' : 'no-repeat'; | ||
var css = 'url(' + url + ') 0% 0% ' + repeat + ' fixed ' + (color || ''); | ||
setBodyBackground(css); | ||
@@ -24,0 +25,0 @@ } |
@@ -18,5 +18,5 @@ var plugin = require('./index'); | ||
it('should put background image on body', function () { | ||
it('should put a no tiling background image on body', function () { | ||
var imageUrl = 'http://www.test.com/fooimage'; | ||
var expectedStyle = 'url(' + imageUrl + ') 0% 0% repeat fixed'; | ||
var expectedStyle = 'url(' + imageUrl + ') 0% 0% no-repeat fixed'; | ||
plugin(pluginApi, {}); | ||
@@ -35,2 +35,20 @@ | ||
it('should put a tiling background image on body', function () { | ||
var imageUrl = 'http://www.test.com/fooimage'; | ||
var tiling = 'yes'; | ||
var expectedStyle = 'url(' + imageUrl + ') 0% 0% repeat fixed'; | ||
plugin(pluginApi, {}); | ||
var options = { | ||
rendered : { | ||
wallpaperimage : imageUrl, | ||
wallpapertiling : tiling | ||
} | ||
}; | ||
pluginApi.trigger('item:afterrender', options); | ||
expect(document.body.style.background).to.equal(expectedStyle); | ||
}); | ||
it('should set background color on body', function() { | ||
@@ -37,0 +55,0 @@ var color = 'rgb(255, 136, 51)'; |
{ | ||
"name": "gardr-plugin-host-wallpaper", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Gardr host plugin receiving a wallpaper url and puts it on the body as a background", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6061
148