blob: f8ac173feda7d0e9f88a962d9dad8b91d244c703 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
angular.scenario.GIVEN = {
browser:function(){
var self = this;
if (jQuery.browser.safari && this.frame.attr('src') == this.at) {
this.window.location.reload();
} else {
this.frame.attr('src', this.at);
}
return function(done){
self.frame.load(function(){
self.frame.unbind();
done();
});
};
},
dataset:function(){
this.frame.name="$DATASET:" + toJson({dataset:this.dataset});
}
};
angular.scenario.WHEN = {
enter:function(){
var element = this.element(this.at);
element.attr('value', this.text);
element.change();
},
click:function(){
var element = this.element(this.at);
var input = element[0];
// emulate the browser behavior which causes it
// to be overridden at the end.
var checked = input.checked = !input.checked;
element.click();
input.checked = checked;
},
select:function(){
var element = this.element(this.at);
var path = "option[value=" + this.option + "]";
var option = this.assert(element.find(path));
option[0].selected = !option[0].selected;
element.change();
}
};
angular.scenario.THEN = {
text:function(){
var element = this.element(this.at);
if (typeof this.should_be != undefined ) {
var should_be = this.should_be;
if (_.isArray(this.should_be))
should_be = JSON.stringify(should_be);
if (element.text() != should_be)
throw "Expected " + should_be +
" but was " + element.text() + ".";
}
},
drainRequestQueue:function(){
}
};
|