Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mooyman committed Aug 4, 2014
1 parent 5503c1d commit 2c24d51
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 39 deletions.
4 changes: 2 additions & 2 deletions templates/forms/CheckboxSetField.ss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<% if $Options.Count %>
<% loop $Options %>
<li class="$Class">
<input id="$ID" class="checkbox" name="$Name.ATT" type="checkbox" value="$Value.ATT"<% if $isChecked %> checked="checked"<% end_if %><% if $isDisabled %> disabled="disabled"<% end_if %> />
<label for="$ID">$Title.XML</label>
<input id="$ID" class="checkbox" name="$Name" type="checkbox" value="$Value"<% if $isChecked %> checked="checked"<% end_if %><% if $isDisabled %> disabled="disabled"<% end_if %> />
<label for="$ID">$Title</label>
</li>
<% end_loop %>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/DropdownField.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<select $AttributesHTML>
<% loop $Options %>
<option value="$Value.ATT"<% if $Selected %> selected="selected"<% end_if %><% if $Disabled %> disabled="disabled"<% end_if %>>$Title.XML</option>
<option value="$Value.XML"<% if $Selected %> selected="selected"<% end_if %><% if $Disabled %> disabled="disabled"<% end_if %>>$Title.XML</option>
<% end_loop %>
</select>
4 changes: 2 additions & 2 deletions templates/forms/OptionsetField.ss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<ul id="$ID" class="$extraClass">
<% loop $Options %>
<li class="$Class">
<input id="$ID" class="radio" name="$Name.ATT" type="radio" value="$Value.ATT"<% if $isChecked %> checked<% end_if %><% if $isDisabled %> disabled<% end_if %> />
<label for="$ID">$Title.XML</label>
<input id="$ID" class="radio" name="$Name" type="radio" value="$Value"<% if $isChecked %> checked<% end_if %><% if $isDisabled %> disabled<% end_if %> />
<label for="$ID">$Title</label>
</li>
<% end_loop %>
</ul>
11 changes: 0 additions & 11 deletions tests/forms/CheckboxSetFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,6 @@ public function testSavingIntoTextField() {
$this->assertEquals('Test,Another', $dbValue);
}

public function testEscapedOptions() {
$field = new CheckboxSetField('Content', 'Content', array(
'Test' => 'Test',
'Another<weirdvalue>' => 'Another',
));

$html = $field->Field();
$this->assertContains('Content[Another&lt;weirdvalue&gt;]', $html, 'Option name is escaped');
$this->assertContains('value="Another&lt;weirdvalue&gt;', $html, 'Option value is escaped');
}

}

/**
Expand Down
14 changes: 2 additions & 12 deletions tests/forms/DropdownFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,7 @@ public function testNumberOfDisabledOptions() {
$disabledOptions = $this->findDisabledOptionElements($field->Field());
$this->assertEquals(count($disabledOptions), 0, 'There are no disabled options');
}

public function testEscapedOptions() {
$field = new DropdownField('Content', 'Content', array(
'Test' => 'Test',
'Another<weirdvalue>' => 'Another',
));

$html = $field->Field();
$this->assertContains('value="Another&lt;weirdvalue&gt;', $html, 'Option value is escaped');
}


/**
* Create a test dropdown field, with the option to
* set what source and blank value it should contain
Expand Down Expand Up @@ -303,4 +293,4 @@ public function findDisabledOptionElements($html) {
return $foundDisabled;
}

}
}
11 changes: 0 additions & 11 deletions tests/forms/OptionsetFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,4 @@ public function testReadonlyField() {
preg_match('/Yes/', $field->Field(), $matches);
$this->assertEquals($matches[0], 'Yes');
}

public function testEscapedOptions() {
$field = new OptionsetField('Content', 'Content', array(
'Test' => 'Test',
'Another<weirdvalue>' => 'Another',
));

$html = $field->Field();
$this->assertContains('value="Another&lt;weirdvalue&gt;', $html, 'Option value is escaped');
}

}

0 comments on commit 2c24d51

Please sign in to comment.