fix some of the failing ie tests

This commit is contained in:
Misko Hevery 2010-10-20 23:17:59 -07:00
parent c6107fe8ac
commit 05d4971abb
5 changed files with 17 additions and 11 deletions

Binary file not shown.

View file

@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript" src="../angular-scenario.js"></script>
<script type="text/javascript" src="../build/angular-scenario.js"></script>
<script type="text/javascript" src="widgets-scenario.js"></script>
</head>
<body>

View file

@ -93,7 +93,7 @@ function lex(text, parseStringsForObjects){
}
function isWhitespace(ch) {
return ch == ' ' || ch == '\r' || ch == '\t' ||
ch == '\n' || ch == '\v';
ch == '\n' || ch == '\v' || ch == '\u00A0'; // IE treats non-breaking space as \u00A0
}
function isIdent(ch) {
return 'a' <= ch && ch <= 'z' ||

View file

@ -64,7 +64,7 @@ angular.scenario.matcher = angular.scenario.matcher || function(name, fn) {
prefix += 'not ';
}
var self = this;
this.addFuture(prefix + name + ' ' + angular.toJson(expected),
this.addFuture(prefix + name + ' ' + angular.toJson(expected),
function(done) {
var error;
self.actual = self.future.value;
@ -129,7 +129,7 @@ function formatException(error, maxStackLines) {
}
/**
* Returns a function that gets the file name and line number from a
* Returns a function that gets the file name and line number from a
* location in the stack if available based on the call site.
*
* Note: this returns another function because accessing .stack is very
@ -137,10 +137,10 @@ function formatException(error, maxStackLines) {
*/
function callerFile(offset) {
var error = new Error();
return function() {
var line = (error.stack || '').split('\n')[offset];
// Clean up the stack trace line
if (line) {
if (line.indexOf('@') !== -1) {
@ -151,7 +151,7 @@ function callerFile(offset) {
line = line.substring(line.indexOf('(')+1).replace(')', '');
}
}
return line || '';
};
}
@ -188,6 +188,12 @@ function browserTrigger(element, type) {
type = 'change';
}
if (msie) {
switch(element.type) {
case 'radio':
case 'checkbox':
element.checked = !element.checked;
break;
}
element.fireEvent('on' + type);
} else {
var evnt = document.createEvent('MouseEvents');
@ -200,9 +206,9 @@ function browserTrigger(element, type) {
* Don't use the jQuery trigger method since it works incorrectly.
*
* jQuery notifies listeners and then changes the state of a checkbox and
* does not create a real browser event. A real click changes the state of
* does not create a real browser event. A real click changes the state of
* the checkbox and then notifies listeners.
*
*
* To work around this we instead use our own handler that fires a real event.
*/
_jQuery.fn.trigger = function(type) {

View file

@ -222,11 +222,11 @@ describe("angular.scenario.dsl", function() {
});
it('should execute custom query', function() {
doc.append('<a id="test" href="myUrl"></a>');
doc.append('<a id="test" href="http://example.com/myUrl"></a>');
$root.dsl.element('#test').query(function(elements, done) {
done(null, elements.attr('href'));
});
expect($root.futureResult).toEqual('myUrl');
expect($root.futureResult).toEqual('http://example.com/myUrl');
});
});