From 3b3e8033696e408e699b911c042361d62ce7b7ac Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 19 Feb 2017 17:08:00 -0500 Subject: Redesign task list view --- tests/units/Model/ColorModelTest.php | 92 +++++++++++++++++++++++++++++++++++ tests/units/Model/ColorTest.php | 93 ------------------------------------ 2 files changed, 92 insertions(+), 93 deletions(-) create mode 100644 tests/units/Model/ColorModelTest.php delete mode 100644 tests/units/Model/ColorTest.php (limited to 'tests/units') diff --git a/tests/units/Model/ColorModelTest.php b/tests/units/Model/ColorModelTest.php new file mode 100644 index 00000000..aa225670 --- /dev/null +++ b/tests/units/Model/ColorModelTest.php @@ -0,0 +1,92 @@ +container); + $this->assertEquals('yellow', $colorModel->find('yellow')); + $this->assertEquals('yellow', $colorModel->find('Yellow')); + $this->assertEquals('dark_grey', $colorModel->find('Dark Grey')); + $this->assertEquals('dark_grey', $colorModel->find('dark_grey')); + } + + public function testGetColorProperties() + { + $colorModel = new ColorModel($this->container); + $expected = array( + 'name' => 'Light Green', + 'background' => '#dcedc8', + 'border' => '#689f38', + ); + + $this->assertEquals($expected, $colorModel->getColorProperties('light_green')); + + $expected = array( + 'name' => 'Yellow', + 'background' => 'rgb(245, 247, 196)', + 'border' => 'rgb(223, 227, 45)', + ); + + $this->assertEquals($expected, $colorModel->getColorProperties('foobar')); + } + + public function testGetList() + { + $colorModel = new ColorModel($this->container); + + $colors = $colorModel->getList(); + $this->assertCount(16, $colors); + $this->assertEquals('Yellow', $colors['yellow']); + + $colors = $colorModel->getList(true); + $this->assertCount(17, $colors); + $this->assertEquals('All colors', $colors['']); + $this->assertEquals('Yellow', $colors['yellow']); + } + + public function testGetDefaultColor() + { + $colorModel = new ColorModel($this->container); + $configModel = new ConfigModel($this->container); + + $this->assertEquals('yellow', $colorModel->getDefaultColor()); + + $this->container['memoryCache']->flush(); + $this->assertTrue($configModel->save(array('default_color' => 'red'))); + $this->assertEquals('red', $colorModel->getDefaultColor()); + } + + public function testGetDefaultColors() + { + $colorModel = new ColorModel($this->container); + + $colors = $colorModel->getDefaultColors(); + $this->assertCount(16, $colors); + } + + public function testGetBorderColor() + { + $colorModel = new ColorModel($this->container); + $this->assertEquals('rgb(74, 227, 113)', $colorModel->getBorderColor('green')); + } + + public function testGetBackgroundColor() + { + $colorModel = new ColorModel($this->container); + $this->assertEquals('rgb(189, 244, 203)', $colorModel->getBackgroundColor('green')); + } + + public function testGetCss() + { + $colorModel = new ColorModel($this->container); + $css = $colorModel->getCss(); + + $this->assertStringStartsWith('.task-board.color-yellow', $css); + } +} diff --git a/tests/units/Model/ColorTest.php b/tests/units/Model/ColorTest.php deleted file mode 100644 index 2a2c4b87..00000000 --- a/tests/units/Model/ColorTest.php +++ /dev/null @@ -1,93 +0,0 @@ -container); - $this->assertEquals('yellow', $colorModel->find('yellow')); - $this->assertEquals('yellow', $colorModel->find('Yellow')); - $this->assertEquals('dark_grey', $colorModel->find('Dark Grey')); - $this->assertEquals('dark_grey', $colorModel->find('dark_grey')); - } - - public function testGetColorProperties() - { - $colorModel = new ColorModel($this->container); - $expected = array( - 'name' => 'Light Green', - 'background' => '#dcedc8', - 'border' => '#689f38', - ); - - $this->assertEquals($expected, $colorModel->getColorProperties('light_green')); - - $expected = array( - 'name' => 'Yellow', - 'background' => 'rgb(245, 247, 196)', - 'border' => 'rgb(223, 227, 45)', - ); - - $this->assertEquals($expected, $colorModel->getColorProperties('foobar')); - } - - public function testGetList() - { - $colorModel = new ColorModel($this->container); - - $colors = $colorModel->getList(); - $this->assertCount(16, $colors); - $this->assertEquals('Yellow', $colors['yellow']); - - $colors = $colorModel->getList(true); - $this->assertCount(17, $colors); - $this->assertEquals('All colors', $colors['']); - $this->assertEquals('Yellow', $colors['yellow']); - } - - public function testGetDefaultColor() - { - $colorModel = new ColorModel($this->container); - $configModel = new ConfigModel($this->container); - - $this->assertEquals('yellow', $colorModel->getDefaultColor()); - - $this->container['memoryCache']->flush(); - $this->assertTrue($configModel->save(array('default_color' => 'red'))); - $this->assertEquals('red', $colorModel->getDefaultColor()); - } - - public function testGetDefaultColors() - { - $colorModel = new ColorModel($this->container); - - $colors = $colorModel->getDefaultColors(); - $this->assertCount(16, $colors); - } - - public function testGetBorderColor() - { - $colorModel = new ColorModel($this->container); - $this->assertEquals('rgb(74, 227, 113)', $colorModel->getBorderColor('green')); - } - - public function testGetBackgroundColor() - { - $colorModel = new ColorModel($this->container); - $this->assertEquals('rgb(189, 244, 203)', $colorModel->getBackgroundColor('green')); - } - - public function testGetCss() - { - $colorModel = new ColorModel($this->container); - $css = $colorModel->getCss(); - - $this->assertStringStartsWith('div.color-yellow {', $css); - $this->assertStringEndsWith('td.color-amber { background-color: #ffe082}', $css); - } -} -- cgit v1.2.3