Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasen Yanev committed Mar 21, 2014
1 parent 08aa737 commit 2a9787c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion classes/Kohana/Tart/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function sort_anchor()

return
HTML::anchor(Tart::uri($this->controller()).URL::query(array('sort' => $this->name().':'.$direction)),
$this->label().' '.HTML::tag('i', array('class' => $class)));
$this->label().' '.'<i class="'.$class.'"><i>');
}

protected static function render_association(Jam_Model $item, Jam_Association $association)
Expand Down
9 changes: 8 additions & 1 deletion classes/Kohana/Tart/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ public function render()
}
foreach ($self->columns() as $column)
{
$h('th', array('width' => $column->width(), 'nowrap'), $column->sort() ? $column->sort_anchor() : $column->label());
$attributes = array('width' => $column->width());

if ($column->sort())
{
$attributes['nowrap'] = 'nowrap';
}

$h('th', $attributes, $column->sort() ? $column->sort_anchor() : $column->label());
}
});

Expand Down
4 changes: 3 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

require_once __DIR__.'/../vendor/autoload.php';

Expand Down Expand Up @@ -58,3 +58,5 @@ function test_autoload($class)
HTML::$windowed_urls = TRUE;

Kohana::$environment = Kohana::TESTING;

Request::factory();
10 changes: 7 additions & 3 deletions tests/tests/tableTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php defined('SYSPATH') OR die('No direct script access.');

/**
* Jamtart_TableTest
* Jamtart_TableTest
*
* @group jam-tart
* @group jam-tart.table
*
*
* @package Jam tart
* @author Ivan Kerin
* @copyright (c) 2011-2013 Despark Ltd.
Expand Down Expand Up @@ -55,7 +55,11 @@ public function test_render()
array('id' => 1, 'name' => 'London', 'population' => 10),
array('id' => 2, 'name' => 'New York', 'population' => 15),
));
$columns = array('name' => new Tart_Column(), 'population' => new Tart_Column());
$name = new Tart_Column();
$name->sort(FALSE);
$population = new Tart_Column();
$population->sort(FALSE);
$columns = array('name' => $name, 'population' => $population);
$table = new Tart_Table($collection, $columns);
$table->selected(FALSE);

Expand Down

0 comments on commit 2a9787c

Please sign in to comment.