Skip to content

Commit 100b853

Browse files
committed
Fix for rocketUnit
Updated the label.cfc test file to run the tests with ControllerWithModel model.
1 parent 1c5dda2 commit 100b853

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

vendor/wheels/tests/view/forms/label.cfc

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
component extends="wheels.tests.Test" {
22

33
function setup() {
4-
_controller = application.wirebox.getInstance( "wheels.Controller" );
4+
_controller = controller(name = "ControllerWithModel");
55
set(functionName = "checkBoxTag", encode = false);
66
set(functionName = "textField", encode = false);
77
set(functionName = "textFieldTag", encode = false);
@@ -53,56 +53,49 @@ component extends="wheels.tests.Test" {
5353
/* object based helpers */
5454

5555
function test_custom_label_on_object_helper() {
56-
tag = model("tag").findOne(order = "id");
57-
actual = _controller.textField(objectName = "tag", property = "name", label = "The Label:");
58-
expected = '<label for="tag-name">The Label:<input id="tag-name" maxlength="50" name="tag[name]" type="text" value="releases"></label>';
56+
actual = _controller.textField(objectName = "user", property = "username", label = "The Label:");
57+
expected = '<label for="user-username">The Label:<input id="user-username" maxlength="50" name="user[username]" type="text" value="tonyp"></label>';
5958
assert('actual eq expected');
6059
}
6160

6261
function test_custom_label_on_object_helper_and_overriding_id() {
63-
tag = model("tag").findOne(order = "id");
6462
actual = _controller.textField(
65-
objectName = "tag",
66-
property = "name",
63+
objectName = "user",
64+
property = "username",
6765
label = "The Label:",
6866
id = "the-id"
6967
);
70-
expected = '<label for="the-id">The Label:<input id="the-id" maxlength="50" name="tag[name]" type="text" value="releases"></label>';
68+
expected = '<label for="the-id">The Label:<input id="the-id" maxlength="50" name="user[username]" type="text" value="tonyp"></label>';
7169
assert('actual eq expected');
7270
}
7371

7472
function test_blank_label_on_object_helper() {
75-
tag = model("tag").findOne(order = "id");
76-
actual = _controller.textField(objectName = "tag", property = "name", label = "");
77-
expected = '<input id="tag-name" maxlength="50" name="tag[name]" type="text" value="releases">';
73+
actual = _controller.textField(objectName = "user", property = "username", label = "");
74+
expected = '<input id="user-username" maxlength="50" name="user[username]" type="text" value="tonyp">';
7875
assert('actual eq expected');
7976
}
8077

8178
function test_automatic_label_on_object_helper_with_around_placement() {
82-
tag = model("tag").findOne(order = "id");
83-
actual = _controller.textField(objectName = "tag", property = "name", labelPlacement = "around");
84-
expected = '<label for="tag-name">Tag name<input id="tag-name" maxlength="50" name="tag[name]" type="text" value="releases"></label>';
79+
actual = _controller.textField(objectName = "user", property = "username", labelPlacement = "around");
80+
expected = '<label for="user-username">Username<input id="user-username" maxlength="50" name="user[username]" type="text" value="tonyp"></label>';
8581
assert('actual eq expected');
8682
}
8783

8884
function test_automatic_label_on_object_helper_with_before_placement() {
89-
tag = model("tag").findOne(order = "id");
90-
actual = _controller.textField(objectName = "tag", property = "name", labelPlacement = "before");
91-
expected = '<label for="tag-name">Tag name</label><input id="tag-name" maxlength="50" name="tag[name]" type="text" value="releases">';
85+
actual = _controller.textField(objectName = "user", property = "username", labelPlacement = "before");
86+
expected = '<label for="user-username">Username</label><input id="user-username" maxlength="50" name="user[username]" type="text" value="tonyp">';
9287
assert('actual eq expected');
9388
}
9489

9590
function test_automatic_label_on_object_helper_with_after_placement() {
96-
tag = model("tag").findOne(order = "id");
97-
actual = _controller.textField(objectName = "tag", property = "name", labelPlacement = "after");
98-
expected = '<input id="tag-name" maxlength="50" name="tag[name]" type="text" value="releases"><label for="tag-name">Tag name</label>';
91+
actual = _controller.textField(objectName = "user", property = "username", labelPlacement = "after")
92+
expected = '<input id="user-username" maxlength="50" name="user[username]" type="text" value="tonyp"><label for="user-username">Username</label>'
9993
assert('actual eq expected');
10094
}
10195

10296
function test_automatic_label_on_object_helper_with_non_persisted_property() {
103-
tag = model("tag").findOne(order = "id");
104-
actual = _controller.textField(objectName = "tag", property = "virtual");
105-
expected = '<label for="tag-virtual">Virtual property<input id="tag-virtual" name="tag[virtual]" type="text" value=""></label>';
97+
actual = _controller.textField(objectName = "user", property = "virtual");
98+
expected = '<label for="user-virtual">Virtual<input id="user-virtual" name="user[virtual]" type="text" value=""></label>';
10699
assert('actual eq expected');
107100
}
108101

0 commit comments

Comments
 (0)