Fix CSS tests on Opera

Opera translates name colors to numbers (red -> #ff0000)
Other browsers like FF or Chrome translate number to rgb (#ff0000 -> rgb(255, 0, 0)
So avoiding colors in tests is probably the easiest solution...
This commit is contained in:
Vojta Jina 2011-06-02 20:15:43 +02:00 committed by Igor Minar
parent b6db58c647
commit 9a69677551
3 changed files with 15 additions and 15 deletions

View file

@ -425,10 +425,10 @@ describe('Binder', function(){
it('BindStyle', function(){
var scope = this.compile('<div ng:style="style"/>');
scope.$eval('style={color:"red"}');
scope.$eval('style={height: "10px"}');
scope.$eval();
assertEquals("red", scope.$element.css('color'));
assertEquals("10px", scope.$element.css('height'));
scope.$eval('style={}');
scope.$eval();

View file

@ -196,9 +196,9 @@ describe("directive", function(){
describe('ng:style', function(){
it('should set', function(){
var scope = compile('<div ng:style="{color:\'red\'}"></div>');
var scope = compile('<div ng:style="{height: \'40px\'}"></div>');
scope.$eval();
expect(element.css('color')).toEqual('red');
expect(element.css('height')).toEqual('40px');
});
it('should silently ignore undefined style', function() {
@ -208,15 +208,15 @@ describe("directive", function(){
});
it('should preserve and remove previous style', function(){
var scope = compile('<div style="color:red;" ng:style="myStyle"></div>');
var scope = compile('<div style="height: 10px;" ng:style="myStyle"></div>');
scope.$eval();
expect(getStyle(element)).toEqual({color:'red'});
scope.myStyle = {color:'blue', width:'10px'};
expect(getStyle(element)).toEqual({height: '10px'});
scope.myStyle = {height: '20px', width: '10px'};
scope.$eval();
expect(getStyle(element)).toEqual({color:'blue', width:'10px'});
expect(getStyle(element)).toEqual({height: '20px', width: '10px'});
scope.myStyle = {};
scope.$eval();
expect(getStyle(element)).toEqual({color:'red'});
expect(getStyle(element)).toEqual({height: '10px'});
});
});

View file

@ -273,15 +273,15 @@ describe("angular.scenario.dsl", function() {
});
it('should get css', function() {
doc.append('<div id="test" style="border: 1px solid red"></div>');
$root.dsl.element('#test').css('border');
expect($root.futureResult).toMatch(/red/);
doc.append('<div id="test" style="height: 30px"></div>');
$root.dsl.element('#test').css('height');
expect($root.futureResult).toMatch(/30px/);
});
it('should set css', function() {
doc.append('<div id="test" style="border: 1px solid red"></div>');
$root.dsl.element('#test').css('border', '1px solid green');
expect(doc.find('#test').css('border')).toMatch(/green/);
doc.append('<div id="test" style="height: 10px"></div>');
$root.dsl.element('#test').css('height', '20px');
expect(doc.find('#test').css('height')).toEqual('20px');
});
it('should add all jQuery key/value methods', function() {