view release on metacpan or search on metacpan
1.01 2014-01-06
- don't "use" optional modules in tests
1.00 2013-12-16
- tests updated for HTML-FormFu v1.00 changes
0.09010 2012-10-05
- Support belongs_to rel with a ComboBox element.
- localize_label works with non-column label accessors.
- Add support to create required belongs_to rels (pshangov).
- options_from_model() can populate from DBIx::Class ENUM values.
- Constraint::DBIC::Unique - new id_field() and method_name() methods.
- Constraint::DBIC::Unique - others() now supports nested_names values.
t/default_values/belongs_to_lookup_table_combobox.yml view on Meta::CPAN
---
auto_fieldset: 1
elements:
- type: Hidden
name: id
- type: Text
name: text_col
- type: ComboBox
name: type
# set this, so options_from_model() populates the menu,
# so we can test the correct default is set
model_config:
resultset: Type
select_column: id
text_column: type
- type: ComboBox
name: type2_id
- type: Submit
name: submit
t/default_values/has_many_combobox.t view on Meta::CPAN
use warnings;
use Test::More tests => 1;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/default_values/has_many_combobox.yml');
my $schema = new_schema();
my $master = $schema->resultset('Master')->create({ id => 1 });
{
# insert some entries we'll ignore, so our rels don't have same ids
# user 1
my $u1 = $master->create_related( 'user', { name => 'foo' } );
t/default_values/has_many_combobox.yml view on Meta::CPAN
---
auto_fieldset: 1
elements:
- type: Hidden
name: id
- type: Text
name: name
- type: ComboBox
name: addresses
- type: Hidden
name: count
- type: Submit
name: submit
t/lib/MySchema/Master.pm view on Meta::CPAN
is_nullable => 0,
},
text_col => { data_type => "TEXT", is_nullable => 1 },
password_col => { data_type => "TEXT", is_nullable => 1 },
checkbox_col => {
data_type => "BOOLEAN",
default_value => 1,
is_nullable => 0,
},
select_col => { data_type => "TEXT", is_nullable => 1 },
combobox_col => { data_type => "TEXT", is_nullable => 1 },
radio_col => { data_type => "TEXT", is_nullable => 1 },
radiogroup_col => { data_type => "TEXT", is_nullable => 1 },
array_col => { data_type => "TEXT", is_nullable => 1, is_array => 1 },
date_col => { data_type => "DATETIME", is_nullable => 1 },
type_id => { data_type => "INTEGER", is_nullable => 1 },
type2_id => { data_type => "INTEGER", is_nullable => 1 },
enum_col => { data_type => "ENUM", is_nullable => 1, extra => { list => [qw( a b c )] } },
not_in_form => { data_type => "TEXT", is_nullable => 1 },
);
t/options_from_model/belongs_to_combobox.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 2;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/options_from_model/belongs_to_combobox.yml');
my $schema = new_schema();
$form->stash->{schema} = $schema;
my $type_rs = $schema->resultset('Type');
my $type2_rs = $schema->resultset('Type2');
{
t/options_from_model/belongs_to_combobox.yml view on Meta::CPAN
---
auto_fieldset: 1
elements:
- type: Hidden
name: id
- type: Text
name: text_col
- type: ComboBox
name: type
model_config:
aaa : aaa
- type: ComboBox
name: type2_id
model_config:
resultset: Type2
- type: Submit
name: submit
t/options_from_model/belongs_to_config_zero_combobox.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 1;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/options_from_model/belongs_to_config_zero_combobox.yml');
my $schema = new_schema();
$form->stash->{schema} = $schema;
my $type_rs = $schema->resultset('Type');
my $type2_rs = $schema->resultset('Type2');
{
t/options_from_model/belongs_to_config_zero_combobox.yml view on Meta::CPAN
---
auto_fieldset: 1
elements:
- type: Hidden
name: id
- type: Text
name: text_col
- type: ComboBox
name: type
model_config:
options_from_model: 0
- type: Submit
name: submit
t/options_from_model/condition_from_stash_combobox.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 11;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/options_from_model/condition_from_stash_combobox.yml');
my $schema = new_schema();
$form->stash->{schema} = $schema;
my $master_rs = $schema->resultset('Master');
my $user_rs = $schema->resultset('User');
{
my $m1 = $master_rs->create({ text_col => 'foo' });
t/options_from_model/condition_from_stash_combobox_complex.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 5;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/options_from_model/condition_from_stash_combobox.yml');
my $schema = new_schema();
$form->stash->{schema} = $schema;
my $master_rs = $schema->resultset('Master');
my $user_rs = $schema->resultset('User');
{
my $m1 = $master_rs->create({ text_col => 'foo' });
t/update/basic.yml view on Meta::CPAN
name: checkbox_col
value: foo
- type: Select
name: select_col
options:
- [1, one]
- [2, two]
- [3, three]
- type: ComboBox
name: combobox_col
options:
- [1, one]
- [2, two]
- [3, three]
- type: Radio
name: radio_col
value: yes
- type: Radio
t/update/basic_create.t view on Meta::CPAN
my $rs = $schema->resultset('Master');
# Fake submitted form
$form->process( {
id => 1,
text_col => 'a',
password_col => 'b',
checkbox_col => 'foo',
select_col => '2',
combobox_col_select => 'sel',
combobox_col_text => '',
radio_col => 'yes',
radiogroup_col => '3',
array_col => [qw(one two)],
} );
{
my $row = $rs->new( {} );
$form->model->update($row);
}
{
my $row = $rs->find(1);
is( $row->text_col, 'a' );
is( $row->password_col, 'b' );
is( $row->checkbox_col, 'foo' );
is( $row->select_col, '2' );
is( $row->combobox_col, 'sel' );
is( $row->radio_col, 'yes' );
is( $row->radiogroup_col, '3' );
is( ($row->array_col)->[0], 'one' );
is( ($row->array_col)->[1], 'two' );
}
$form->process( {
id => '',
text_col => 'a2',
password_col => 'b2',
t/update/basic_update.t view on Meta::CPAN
my $schema = new_schema();
my $rs = $schema->resultset('Master');
{
my $row = $rs->new_result( {
text_col => 'xyza',
password_col => 'xyzb',
checkbox_col => 'xyzfoo',
select_col => 'xyz2',
combobox_col => 'combo',
radio_col => 'xyzyes',
radiogroup_col => 'xyz3',
array_col => [qw(abc xyz)],
} );
$row->insert;
}
# Fake submitted form
$form->process( {
id => 1,
text_col => 'a',
password_col => 'b',
checkbox_col => 'foo',
select_col => '2',
combobox_col_select => '',
combobox_col_text => 'txt',
radio_col => 'yes',
radiogroup_col => '3',
array_col => [qw(one two)],
} );
{
my $row = $rs->find(1);
$form->model->update($row);
}
{
my $row = $rs->find(1);
is( $row->text_col, 'a' );
is( $row->password_col, 'b' );
is( $row->checkbox_col, 'foo' );
is( $row->combobox_col, 'txt' );
is( $row->select_col, '2' );
is( $row->radio_col, 'yes' );
is( $row->radiogroup_col, '3' );
is( ($row->array_col)->[0], 'one' );
is( ($row->array_col)->[1], 'two' );
}
t/update/belongs_to_combobox.t view on Meta::CPAN
use warnings;
use Test::More tests => 2;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/default_values/belongs_to_lookup_table_combobox.yml');
my $schema = new_schema();
$form->stash->{schema} = $schema;
my $rs = $schema->resultset('Master');
# filler rows
{
# insert some entries we'll ignore, so our rels don't have same ids
t/update/belongs_to_lookup_table_combobox.t view on Meta::CPAN
use warnings;
use Test::More tests => 6;
use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;
$form->load_config_file('t/update/belongs_to_lookup_table_combobox.yml');
my $schema = new_schema();
$form->stash->{schema} = $schema;
my $rs = $schema->resultset('Master');
# filler rows
{
# insert some entries we'll ignore, so our rels don't have same ids
t/update/nested.yml view on Meta::CPAN
name: checkbox_col
value: foo
- type: Select
name: select_col
options:
- [1, one]
- [2, two]
- [3, three]
- type: ComboBox
name: combobox_col
options:
- [1, one]
- [2, two]
- [3, three]
- type: Radio
name: radio_col
value: yes
- type: Radio
t/update/nested_create.t view on Meta::CPAN
my $rs = $schema->resultset('Master');
# Fake submitted form
$form->process( {
"foo.id" => 1,
"foo.text_col" => 'a',
"foo.password_col" => 'b',
"foo.checkbox_col" => 'foo',
"foo.select_col" => '2',
"foo.combobox_col_select" => "",
"foo.combobox_col_text" => "combo",
"foo.radio_col" => 'yes',
"foo.radiogroup_col" => '3',
} );
{
my $row = $rs->new( {} );
$form->model->update( $row, { nested_base => 'foo' } );
}
{
my $row = $rs->find(1);
is( $row->text_col, 'a' );
is( $row->password_col, 'b' );
is( $row->checkbox_col, 'foo' );
is( $row->select_col, '2' );
is( $row->combobox_col, 'combo' );
is( $row->radio_col, 'yes' );
is( $row->radiogroup_col, '3' )
}
view all matches for this distributionview release on metacpan - search on metacpan