1 describe('Binding: CSS style', {
2 before_each: JSSpec.prepareTestNode,
4 'Should give the element the specified CSS style value': function () {
5 var myObservable = new ko.observable("red");
6 testNode.innerHTML = "<div data-bind='style: { backgroundColor: colorValue }'>Hallo</div>";
7 ko.applyBindings({ colorValue: myObservable }, testNode);
9 value_of(testNode.childNodes[0].style.backgroundColor).should_be_one_of(["red", "#ff0000"]); // Opera returns style color values in #rrggbb notation, unlike other browsers
10 myObservable("green");
11 value_of(testNode.childNodes[0].style.backgroundColor).should_be_one_of(["green", "#008000"]);
12 myObservable(undefined);
13 value_of(testNode.childNodes[0].style.backgroundColor).should_be("");