appetizer-ui 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/appetizer-ui.gemspec +15 -13
- data/lib/appetizer/ui/assets.rb +21 -8
- data/lib/appetizer/ui/jasmine/js/jquery-jasmine.js +288 -0
- data/lib/appetizer/ui/jasmine/js/spec-runner.coffee +0 -1
- data/lib/appetizer/ui/jasmine/views/specs.erb +12 -4
- data/lib/appetizer/ui/rake.rb +29 -10
- data/lib/appetizer/ui/spec.rb +1 -2
- metadata +122 -61
- data/lib/appetizer/ui/app/js/appetizer.coffee +0 -15
- data/lib/appetizer/ui/app/js/appetizer/core.coffee +0 -20
- data/lib/appetizer/ui/app/js/appetizer/model.coffee +0 -1
- data/lib/appetizer/ui/app/js/appetizer/router.coffee +0 -70
- data/lib/appetizer/ui/app/js/appetizer/view.coffee +0 -139
- data/lib/appetizer/ui/app/js/appetizer/xdr.coffee +0 -57
- data/lib/appetizer/ui/app/views/client/appetizer/missing.jst.eco +0 -3
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/appetizerExtensions.spec.js +0 -54
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/checkboxConventionBindings.spec.js +0 -110
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/configurableBindingAttributes.spec.js +0 -117
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/configureAllBindingAttributes.spec.js +0 -139
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/customConvention.spec.js +0 -53
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/dataBindConvention.spec.js +0 -151
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/dataBindMultiple.spec.js +0 -36
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/dataBindSubstitutions.spec.js +0 -137
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/globalConfiguraAllBindingAttributes.spec.js +0 -124
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/globalConfigurableBindingAttributes.spec.js +0 -36
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/helpers/SpecHelper.js +0 -4
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/helpers/sample.backbone.app.js +0 -159
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/html5inputConventionBinding.spec.js +0 -142
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/modelUnbinding.spec.js +0 -73
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/noConflict.spec.js +0 -36
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/radioButtonConventionBinding.spec.js +0 -41
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/selectboxConventionBindings.spec.js +0 -60
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/textareaConventionBinding.spec.js +0 -29
- data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/textboxConventionBinding.spec.js +0 -66
- data/lib/appetizer/ui/vendor/js/backbone.js +0 -1290
- data/lib/appetizer/ui/vendor/js/backbone.modelbinding.js +0 -624
- data/lib/appetizer/ui/vendor/js/jquery.js +0 -9266
- data/lib/appetizer/ui/vendor/js/json2.js +0 -480
- data/lib/appetizer/ui/vendor/js/underscore.js +0 -999
- data/lib/appetizer/ui/vendor/js/underscore.string.js +0 -480
@@ -1,53 +0,0 @@
|
|
1
|
-
describe("custom conventions", function(){
|
2
|
-
beforeEach(function(){
|
3
|
-
this.model = new AModel({});
|
4
|
-
this.view = new AView({model: this.model});
|
5
|
-
this.oldHandler = Backbone.ModelBinding.Conventions.text.handler;
|
6
|
-
|
7
|
-
});
|
8
|
-
|
9
|
-
afterEach(function(){
|
10
|
-
Backbone.ModelBinding.Conventions.text.handler = this.oldHandler;
|
11
|
-
});
|
12
|
-
|
13
|
-
describe("replace the text input handler", function(){
|
14
|
-
beforeEach(function(){
|
15
|
-
var nameSettingsHandler = {
|
16
|
-
bind: function(selector, view, model){
|
17
|
-
view.$("#name").val("a custom convention supplied this name");
|
18
|
-
}
|
19
|
-
};
|
20
|
-
|
21
|
-
Backbone.ModelBinding.Conventions.text.handler = nameSettingsHandler;
|
22
|
-
this.view.render();
|
23
|
-
});
|
24
|
-
|
25
|
-
it("should set the custom field value when rendered", function(){
|
26
|
-
expect(this.view.$("#name").val()).toBe("a custom convention supplied this name");
|
27
|
-
});
|
28
|
-
});
|
29
|
-
|
30
|
-
describe("add a brand new convention for paragraph tags", function(){
|
31
|
-
beforeEach(function(){
|
32
|
-
var PConvention = {
|
33
|
-
selector: "p",
|
34
|
-
handler: {
|
35
|
-
bind: function(selector, view, model){
|
36
|
-
view.$(selector).each(function(index){
|
37
|
-
var name = model.get("name");
|
38
|
-
$(this).html(name);
|
39
|
-
});
|
40
|
-
}
|
41
|
-
}
|
42
|
-
};
|
43
|
-
|
44
|
-
Backbone.ModelBinding.Conventions.paragraphs = PConvention;
|
45
|
-
});
|
46
|
-
|
47
|
-
it("should display the model name in the paragraph", function(){
|
48
|
-
this.model.set({name: "Gandalf Wizard"});
|
49
|
-
this.view.render();
|
50
|
-
expect(this.view.$("#aParagraph").html()).toBe("Gandalf Wizard");
|
51
|
-
});
|
52
|
-
});
|
53
|
-
});
|
@@ -1,151 +0,0 @@
|
|
1
|
-
describe("data-bind conventions", function(){
|
2
|
-
beforeEach(function(){
|
3
|
-
this.model = new AModel({
|
4
|
-
villain: "mrMonster",
|
5
|
-
doctor: "Seuss",
|
6
|
-
pet: "cat",
|
7
|
-
isValid: false
|
8
|
-
});
|
9
|
-
this.view = new AView({model: this.model});
|
10
|
-
});
|
11
|
-
|
12
|
-
describe("when data-bind is configured for an event and the event is triggered", function(){
|
13
|
-
beforeEach(function(){
|
14
|
-
this.view.render();
|
15
|
-
this.el = this.view.$("#eventDiv");
|
16
|
-
this.model.trigger("foo", "bar");
|
17
|
-
});
|
18
|
-
|
19
|
-
it("should update the element with the event's value", function(){
|
20
|
-
expect(this.el.text()).toBe("bar");
|
21
|
-
});
|
22
|
-
});
|
23
|
-
|
24
|
-
describe("when a data-bind is configured with no html element attribute specified", function(){
|
25
|
-
beforeEach(function(){
|
26
|
-
this.view.render();
|
27
|
-
this.el = this.view.$("#doctor_no_elem");
|
28
|
-
});
|
29
|
-
|
30
|
-
it("should set the element's text to the model's property value immediately", function(){
|
31
|
-
expect(this.el.text()).toBe("Seuss");
|
32
|
-
});
|
33
|
-
|
34
|
-
it("should set the text of the element when the model's property changes", function(){
|
35
|
-
this.model.set({doctor: "Who"});
|
36
|
-
expect(this.el.text()).toBe("Who");
|
37
|
-
});
|
38
|
-
});
|
39
|
-
|
40
|
-
describe("when a data-bind is configured to set text", function(){
|
41
|
-
beforeEach(function(){
|
42
|
-
this.view.render();
|
43
|
-
this.el = this.view.$("#doctor");
|
44
|
-
});
|
45
|
-
|
46
|
-
it("should set the element's text to the model's property value immediately", function(){
|
47
|
-
expect(this.el.text()).toBe("Seuss");
|
48
|
-
});
|
49
|
-
|
50
|
-
it("should set the text of the element when the model's property changes", function(){
|
51
|
-
this.model.set({doctor: "Who"});
|
52
|
-
expect(this.el.text()).toBe("Who");
|
53
|
-
});
|
54
|
-
});
|
55
|
-
|
56
|
-
describe("when a data-bind is configured to set html", function(){
|
57
|
-
beforeEach(function(){
|
58
|
-
this.view.render();
|
59
|
-
this.el = this.view.$("#villain");
|
60
|
-
});
|
61
|
-
|
62
|
-
it("should set the element's contents to the model's property value immediately", function(){
|
63
|
-
expect(this.el.html()).toBe("mrMonster");
|
64
|
-
});
|
65
|
-
|
66
|
-
it("should replace the contents of the element when the model's property changes", function(){
|
67
|
-
this.model.set({villain: "boogerFace"});
|
68
|
-
expect(this.el.html()).toBe("boogerFace");
|
69
|
-
});
|
70
|
-
});
|
71
|
-
|
72
|
-
describe("when a data-bind is configured to set enabled", function(){
|
73
|
-
beforeEach(function(){
|
74
|
-
this.view.render();
|
75
|
-
this.el = this.view.$("#clicker");
|
76
|
-
});
|
77
|
-
|
78
|
-
it("should set the element's disabled value to the model's value, immediately", function(){
|
79
|
-
expect(this.el.attr("disabled")).toBeTruthy();
|
80
|
-
});
|
81
|
-
|
82
|
-
it("should set the element's disabled value when the model's value is changed", function(){
|
83
|
-
this.model.set({isValid: true});
|
84
|
-
expect(this.el.attr("disabled")).toBeFalsy();
|
85
|
-
});
|
86
|
-
});
|
87
|
-
|
88
|
-
describe("when a data-bind is configured to set disabled", function(){
|
89
|
-
beforeEach(function(){
|
90
|
-
this.view.render();
|
91
|
-
this.el = this.view.$("#unclicker");
|
92
|
-
});
|
93
|
-
|
94
|
-
it("should set the element's disabled value to the model's value, immediately", function(){
|
95
|
-
expect(this.el.attr("disabled")).toBeFalsy();
|
96
|
-
});
|
97
|
-
|
98
|
-
it("should set the element's disabled value when the model's value is changed", function(){
|
99
|
-
this.model.set({isValid: true});
|
100
|
-
expect(this.el.attr("disabled")).toBeTruthy();
|
101
|
-
});
|
102
|
-
});
|
103
|
-
|
104
|
-
describe("when a data-bind is configured to set an arbitrary attribute", function(){
|
105
|
-
beforeEach(function(){
|
106
|
-
this.view.render();
|
107
|
-
this.el = this.view.$("#pet");
|
108
|
-
});
|
109
|
-
|
110
|
-
it("should set the element's attribute to the model's property value immediately", function(){
|
111
|
-
expect(this.el.attr("someAttr")).toBe("cat");
|
112
|
-
});
|
113
|
-
|
114
|
-
it("should set the value of the attribute", function(){
|
115
|
-
this.model.set({pet: "bunnies"});
|
116
|
-
expect(this.el.attr("someAttr")).toBe("bunnies");
|
117
|
-
});
|
118
|
-
});
|
119
|
-
|
120
|
-
describe("when a data-bind is configured to set displayed", function(){
|
121
|
-
beforeEach(function(){
|
122
|
-
this.view.render();
|
123
|
-
this.el = $(this.view.el).find("#showHideThing");
|
124
|
-
});
|
125
|
-
|
126
|
-
it("should set the element's disabled value to the model's value, immediately", function(){
|
127
|
-
expect(this.el.css("display")).toBe("none");
|
128
|
-
});
|
129
|
-
|
130
|
-
it("should set the element's disabled value when the model's value is changed", function(){
|
131
|
-
this.model.set({isValid: true});
|
132
|
-
expect(this.el).toBeVisible();
|
133
|
-
});
|
134
|
-
});
|
135
|
-
|
136
|
-
describe("when a data-bind is configured to set visible", function(){
|
137
|
-
beforeEach(function(){
|
138
|
-
this.view.render();
|
139
|
-
this.el = $(this.view.el).find("#showHideAnotherThing");
|
140
|
-
});
|
141
|
-
|
142
|
-
it("should set the element's disabled value to the model's value, immediately", function(){
|
143
|
-
expect(this.el.css("display")).not.toBe("none");
|
144
|
-
});
|
145
|
-
|
146
|
-
it("should set the element's disabled value when the model's value is changed", function(){
|
147
|
-
this.model.set({isValid: true});
|
148
|
-
expect(this.el).toBeHidden();
|
149
|
-
});
|
150
|
-
});
|
151
|
-
});
|
@@ -1,36 +0,0 @@
|
|
1
|
-
describe("data-bind multiple attributes", function(){
|
2
|
-
beforeEach(function(){
|
3
|
-
this.model = new AModel({
|
4
|
-
urlSrc: "/foo/bar.gif",
|
5
|
-
name: "me"
|
6
|
-
});
|
7
|
-
this.view = new AView({model: this.model});
|
8
|
-
this.view.render();
|
9
|
-
this.el = this.view.$("#avatar");
|
10
|
-
});
|
11
|
-
|
12
|
-
describe ("when initializing", function(){
|
13
|
-
it("should set the first bound attribute", function(){
|
14
|
-
expect(this.el.attr("src")).toBe("/foo/bar.gif");
|
15
|
-
});
|
16
|
-
|
17
|
-
it("shoudl set the second bound attribute", function(){
|
18
|
-
expect(this.el.attr("class")).toBe("me");
|
19
|
-
});
|
20
|
-
});
|
21
|
-
|
22
|
-
describe("when setting the values", function(){
|
23
|
-
beforeEach(function(){
|
24
|
-
this.model.set({urlSrc: "/empty.png", name: "you"});
|
25
|
-
});
|
26
|
-
|
27
|
-
it("should update the first bound attribute", function(){
|
28
|
-
expect(this.el.attr("src")).toBe("/empty.png");
|
29
|
-
});
|
30
|
-
|
31
|
-
it("should update the second bound attribute", function(){
|
32
|
-
expect(this.el.attr("class")).toBe("you");
|
33
|
-
});
|
34
|
-
});
|
35
|
-
|
36
|
-
});
|
@@ -1,137 +0,0 @@
|
|
1
|
-
describe("default data-bind substitutions", function(){
|
2
|
-
beforeEach(function(){
|
3
|
-
this.model = new AModel({
|
4
|
-
doctor: "Seuss",
|
5
|
-
name: "foo"
|
6
|
-
});
|
7
|
-
this.view = new AView({model: this.model});
|
8
|
-
this.view.render();
|
9
|
-
});
|
10
|
-
|
11
|
-
describe("when binding unsetting the model's property that is bound to an unconfigured attribute", function(){
|
12
|
-
beforeEach(function(){
|
13
|
-
this.model.unset("name");
|
14
|
-
this.el = this.view.$("#avatar");
|
15
|
-
});
|
16
|
-
|
17
|
-
it("should use the 'default' substitution setting", function(){
|
18
|
-
expect(this.el.attr("class")).toBe("");
|
19
|
-
});
|
20
|
-
});
|
21
|
-
|
22
|
-
describe("when binding to text and unsetting the model's property", function(){
|
23
|
-
beforeEach(function(){
|
24
|
-
this.model.unset("doctor");
|
25
|
-
this.el = this.view.$("#doctor");
|
26
|
-
});
|
27
|
-
|
28
|
-
it("should set the text to an empty string", function(){
|
29
|
-
expect(this.el.text()).toBe("");
|
30
|
-
});
|
31
|
-
});
|
32
|
-
|
33
|
-
describe("when binding to html and unsetting the model's property", function(){
|
34
|
-
beforeEach(function(){
|
35
|
-
this.model.unset("villain");
|
36
|
-
this.el = this.view.$("#villain");
|
37
|
-
});
|
38
|
-
|
39
|
-
it("should set the html to an empty string", function(){
|
40
|
-
expect(this.el.html()).toBe("");
|
41
|
-
});
|
42
|
-
});
|
43
|
-
|
44
|
-
});
|
45
|
-
|
46
|
-
describe("configured data-bind substitutions", function(){
|
47
|
-
beforeEach(function(){
|
48
|
-
Backbone.ModelBinding.Configuration.dataBindSubst({
|
49
|
-
text: "text subst",
|
50
|
-
html: " "
|
51
|
-
});
|
52
|
-
this.model = new AModel({
|
53
|
-
doctor: "Seuss"
|
54
|
-
});
|
55
|
-
this.view = new AView({model: this.model});
|
56
|
-
this.view.render();
|
57
|
-
});
|
58
|
-
|
59
|
-
afterEach(function(){
|
60
|
-
Backbone.ModelBinding.Configuration.restoreDataBindSubstConfig();
|
61
|
-
});
|
62
|
-
|
63
|
-
describe("when binding to text and unsetting the model's property", function(){
|
64
|
-
beforeEach(function(){
|
65
|
-
this.model.unset("doctor");
|
66
|
-
this.el = this.view.$("#doctor");
|
67
|
-
});
|
68
|
-
|
69
|
-
it("should set the text to an empty string", function(){
|
70
|
-
expect(this.el.text()).toBe("text subst");
|
71
|
-
});
|
72
|
-
});
|
73
|
-
|
74
|
-
describe("when binding to html and unsetting the model's property", function(){
|
75
|
-
beforeEach(function(){
|
76
|
-
this.model.unset("villain");
|
77
|
-
this.el = this.view.$("#villain");
|
78
|
-
});
|
79
|
-
|
80
|
-
it("should set the html to an empty string", function(){
|
81
|
-
expect(this.el.html()).toBe(" ");
|
82
|
-
});
|
83
|
-
});
|
84
|
-
|
85
|
-
});
|
86
|
-
|
87
|
-
describe("resetting the data bind substitutions", function(){
|
88
|
-
beforeEach(function(){
|
89
|
-
Backbone.ModelBinding.Configuration.dataBindSubst({
|
90
|
-
text: "text subst",
|
91
|
-
html: "html subst"
|
92
|
-
});
|
93
|
-
this.model = new AModel({
|
94
|
-
doctor: "Seuss",
|
95
|
-
villain: "mort"
|
96
|
-
});
|
97
|
-
this.view = new AView({model: this.model});
|
98
|
-
this.view.render();
|
99
|
-
|
100
|
-
Backbone.ModelBinding.Configuration.restoreDataBindSubstConfig();
|
101
|
-
});
|
102
|
-
|
103
|
-
it("should use the default for text substitutions", function(){
|
104
|
-
this.model.unset("doctor");
|
105
|
-
this.doctorEl = this.view.$("#doctor");
|
106
|
-
expect(this.doctorEl.text()).toBe("");
|
107
|
-
});
|
108
|
-
|
109
|
-
it("should use the default for html substitutions", function(){
|
110
|
-
this.model.unset("villain");
|
111
|
-
this.villainEl = this.view.$("#villain");
|
112
|
-
expect(this.villainEl.html()).toBe("");
|
113
|
-
});
|
114
|
-
});
|
115
|
-
|
116
|
-
describe("when the data-bind attribute is manually configured", function(){
|
117
|
-
beforeEach(function(){
|
118
|
-
Backbone.ModelBinding.Conventions.databind.selector = "*[data-bind-bb]";
|
119
|
-
this.model = new AModel({
|
120
|
-
doctor: "Seuss",
|
121
|
-
villain: "mort"
|
122
|
-
});
|
123
|
-
this.view = new AView({model: this.model});
|
124
|
-
this.view.render();
|
125
|
-
this.el = this.view.$("#doctor_data_bind_bb");
|
126
|
-
Backbone.ModelBinding.Conventions.databind.selector = "*[data-bind]";
|
127
|
-
});
|
128
|
-
|
129
|
-
it("should set the element's text to the model's property value immediately", function(){
|
130
|
-
expect(this.el.text()).toBe("Seuss");
|
131
|
-
});
|
132
|
-
|
133
|
-
it("should set the text of the element when the model's property changes", function(){
|
134
|
-
this.model.set({doctor: "Who"});
|
135
|
-
expect(this.el.text()).toBe("Who");
|
136
|
-
});
|
137
|
-
});
|
data/lib/appetizer/ui/jasmine/js/backbone.modelbinding/globalConfiguraAllBindingAttributes.spec.js
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
describe("global configure all binding attributes", function(){
|
2
|
-
beforeEach(function(){
|
3
|
-
Backbone.ModelBinding.Configuration.store();
|
4
|
-
|
5
|
-
this.model = new AModel({
|
6
|
-
name: "some dude",
|
7
|
-
education: "graduate",
|
8
|
-
graduated: "maybe",
|
9
|
-
drivers_license: true
|
10
|
-
});
|
11
|
-
|
12
|
-
Backbone.ModelBinding.Configuration.configureAllBindingAttributes("class");
|
13
|
-
this.view = new GlobalAllBindingAttributesView({model: this.model});
|
14
|
-
this.view.render();
|
15
|
-
});
|
16
|
-
|
17
|
-
afterEach(function(){
|
18
|
-
Backbone.ModelBinding.Configuration.restore();
|
19
|
-
});
|
20
|
-
|
21
|
-
describe("text element binding using configurable attribute", function(){
|
22
|
-
it("bind view changes to the model's field, by configurable convention", function(){
|
23
|
-
var el = this.view.$("#v_name");
|
24
|
-
el.val("that guy");
|
25
|
-
el.trigger('change');
|
26
|
-
|
27
|
-
expect(this.model.get('name')).toEqual("that guy");
|
28
|
-
});
|
29
|
-
|
30
|
-
it("bind model field changes to the form input, by convention of id", function(){
|
31
|
-
this.model.set({name: "joe bob"});
|
32
|
-
var el = this.view.$("#v_name");
|
33
|
-
expect(el.val()).toEqual("joe bob");
|
34
|
-
});
|
35
|
-
|
36
|
-
it("binds the model's value to the form field on render", function(){
|
37
|
-
var el = this.view.$("#v_name");
|
38
|
-
expect(el.val()).toEqual("some dude");
|
39
|
-
});
|
40
|
-
});
|
41
|
-
|
42
|
-
describe("radio element binding using configurable attribute", function(){
|
43
|
-
it("bind view changes to the model's field, by configurable convention", function(){
|
44
|
-
var el = $(this.view.el).find("#graduated_no");
|
45
|
-
el.attr("checked", "checked");
|
46
|
-
el.trigger('change');
|
47
|
-
expect(this.model.get('graduated')).toEqual("no");
|
48
|
-
});
|
49
|
-
|
50
|
-
it("bind model field changes to the form input, by configurable convention", function(){
|
51
|
-
this.model.set({graduated: "yes"});
|
52
|
-
var el = this.view.$("#graduated_yes");
|
53
|
-
var selected = el.attr("checked");
|
54
|
-
|
55
|
-
expect(selected).toBeTruthy();
|
56
|
-
});
|
57
|
-
|
58
|
-
it("binds the model's value to the form field on render", function(){
|
59
|
-
var el = this.view.$("input[type=radio][class=graduated]:checked");
|
60
|
-
var selected = el.val();
|
61
|
-
|
62
|
-
expect(selected).toBe("maybe");
|
63
|
-
});
|
64
|
-
});
|
65
|
-
|
66
|
-
describe("select element binding using configurable attribute", function(){
|
67
|
-
it("bind view changes to the model's field, by configurable convention", function(){
|
68
|
-
var el = this.view.$(".education");
|
69
|
-
el.val("college");
|
70
|
-
el.trigger('change');
|
71
|
-
|
72
|
-
expect(this.model.get('education')).toEqual("college");
|
73
|
-
});
|
74
|
-
|
75
|
-
it("bind model field changes to the form input, by configurable convention", function(){
|
76
|
-
this.model.set({education: "high school"});
|
77
|
-
var el = this.view.$(".education");
|
78
|
-
expect(el.val()).toEqual("high school");
|
79
|
-
});
|
80
|
-
|
81
|
-
it("binds the model's value to the form field on render", function(){
|
82
|
-
var el = this.view.$(".education");
|
83
|
-
expect(el.val()).toEqual("graduate");
|
84
|
-
});
|
85
|
-
|
86
|
-
it("applies the text of the selection to the model", function(){
|
87
|
-
var el = this.view.$(".education");
|
88
|
-
el.val("grade_school");
|
89
|
-
el.trigger('change');
|
90
|
-
|
91
|
-
expect(this.model.get('education_text')).toEqual("i dun learned at grade skool");
|
92
|
-
});
|
93
|
-
});
|
94
|
-
|
95
|
-
describe("checkbox element binding using configurable attribute", function(){
|
96
|
-
it("bind view changes to the model's field", function(){
|
97
|
-
var el = this.view.$(".drivers_license");
|
98
|
-
el.removeAttr("checked");
|
99
|
-
el.trigger('change');
|
100
|
-
expect(this.model.get('drivers_license')).toBeFalsy();
|
101
|
-
});
|
102
|
-
|
103
|
-
it("bind model field changes to the form input", function(){
|
104
|
-
var el = this.view.$(".drivers_license");
|
105
|
-
|
106
|
-
// uncheck it
|
107
|
-
this.model.set({drivers_license: false});
|
108
|
-
var selected = el.attr("checked");
|
109
|
-
expect(selected).toBeFalsy();
|
110
|
-
|
111
|
-
// then check it
|
112
|
-
this.model.set({drivers_license: true});
|
113
|
-
var selected = el.attr("checked");
|
114
|
-
expect(selected).toBeTruthy();
|
115
|
-
});
|
116
|
-
|
117
|
-
it("binds the model's value to the form field on render", function(){
|
118
|
-
var el = this.view.$(".drivers_license");
|
119
|
-
var selected = el.attr("checked");
|
120
|
-
|
121
|
-
expect(selected).toBeTruthy();
|
122
|
-
});
|
123
|
-
});
|
124
|
-
});
|