Skip to content
Browse files

Cover simple minute and second cases.

  • Loading branch information...
1 parent 2cb910e commit 0f913b98e6d7a759cbf0802b72edd4f1a5d0a627 @markstory markstory committed
Showing with 77 additions and 2 deletions.
  1. +77 −2 tests/TestCase/View/Input/DateTimeTest.php
View
79 tests/TestCase/View/Input/DateTimeTest.php
@@ -470,8 +470,48 @@ public function testRenderHourWidget12() {
$this->assertNotContains('value="0"', $result, 'No zero hour');
}
+/**
+ * Test rendering the minute widget with no options.
+ *
+ * @return void
+ */
public function testRenderMinuteWidget() {
- $this->markTestIncomplete();
+ $now = new \DateTime('2010-09-09 13:25:00');
+ $result = $this->DateTime->render([
+ 'name' => 'date',
+ 'year' => false,
+ 'month' => false,
+ 'day' => false,
+ 'hour' => false,
+ 'minute' => [
+ 'data-foo' => 'test',
+ ],
+ 'second' => false,
+ 'val' => $now,
+ ]);
+ $this->assertContains('<select name="date[minute]" data-foo="test">', $result);
+ $this->assertContains(
+ '<option value="01">01</option>',
+ $result,
+ 'contains 1'
+ );
+ $this->assertContains(
+ '<option value="05">05</option>',
+ $result,
+ 'contains 05'
+ );
+ $this->assertContains(
+ '<option value="25" selected="selected">25</option>',
+ $result,
+ 'selected value present'
+ );
+ $this->assertContains(
+ '<option value="60">60</option>',
+ $result,
+ 'contains 60'
+ );
+ $this->assertNotContains('value="0"', $result, 'No zero value');
+ $this->assertNotContains('value="61"', $result, 'No 61 value');
}
public function testRenderMinuteWidgetInterval() {
@@ -483,7 +523,42 @@ public function testRenderMinuteWidgetIntervalRounding() {
}
public function testRenderSecondsWidget() {
- $this->markTestIncomplete();
+ $now = new \DateTime('2010-09-09 13:00:25');
+ $result = $this->DateTime->render([
+ 'name' => 'date',
+ 'year' => false,
+ 'month' => false,
+ 'day' => false,
+ 'hour' => false,
+ 'minute' => false,
+ 'second' => [
+ 'data-foo' => 'test',
+ ],
+ 'val' => $now,
+ ]);
+ $this->assertContains('<select name="date[second]" data-foo="test">', $result);
+ $this->assertContains(
+ '<option value="01">01</option>',
+ $result,
+ 'contains 1'
+ );
+ $this->assertContains(
+ '<option value="05">05</option>',
+ $result,
+ 'contains 05'
+ );
+ $this->assertContains(
+ '<option value="25" selected="selected">25</option>',
+ $result,
+ 'selected value present'
+ );
+ $this->assertContains(
+ '<option value="60">60</option>',
+ $result,
+ 'contains 60'
+ );
+ $this->assertNotContains('value="0"', $result, 'No zero value');
+ $this->assertNotContains('value="61"', $result, 'No 61 value');
}
public function testRenderMeridianWidget() {

0 comments on commit 0f913b9

Please sign in to comment.
Something went wrong with that request. Please try again.