Skip to content

Commit

Permalink
Item972: add unit test for select+values, and add the missing import
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@2411 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Feb 8, 2009
1 parent 517c74d commit bd889ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions UnitTestContrib/test/unit/FormDefTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,21 @@ FORM
$this->assert_str_equals('', $f->{size});
}

sub test_Item972_selectPlusValues {
my $this = shift;

$this->{twiki}->{store}->saveTopic(
$this->{twiki}->{user}, $this->{test_web}, 'TestForm', <<FORM);
| *Name* | *Type* | *Size* | *Value* | *Tooltip* | *Attributes* |
| Select | select+values | 5 | One, Two=2, Three=III, Four | Various values |
FORM
my $def = new Foswiki::Form($this->{twiki}, $this->{test_web}, 'TestForm');

my $f = $def->getField('Select');
$this->assert_str_equals('select+values', $f->{type});
$this->assert_equals(4, scalar(@{$f->getOptions()}));
$this->assert_str_equals('One,2,III,Four', join(',',@{$f->getOptions()}));
$this->assert_str_equals('Various values', $f->{tooltip});
}

1;
1 change: 1 addition & 0 deletions core/lib/Foswiki/Form/Select.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package Foswiki::Form::Select;
use base 'Foswiki::Form::ListFieldDefinition';

use strict;
use Assert;

sub new {
my $class = shift;
Expand Down

0 comments on commit bd889ea

Please sign in to comment.