Moonshine-Bootstrap
view release on metacpan or search on metacpan
t/119-dropdown.t view on Meta::CPAN
use Moonshine::Test qw/:all/;
use Moonshine::Bootstrap::Component::Dropdown;
use Moonshine::Bootstrap::v3::Dropdown;
moon_test(
name => 'caret',
build => {
class => 'Moonshine::Bootstrap::Component::Dropdown',
},
instructions => [
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
action => 'linked_li',
link => 'http://second.url',
data => 'Second',
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropdown"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul c...
}
],
},
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
action => 'linked_li',
link => 'http://second.url',
data => 'Second',
disable => 1,
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropdown"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul c...
}
],
},
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
data => 'Second',
action => 'dropdown_header_li',
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropdown"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul c...
}
],
},
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
dropup => 1,
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
data => 'Second',
action => 'dropdown_header_li',
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropup"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul cla...
}
],
}
],
);
moon_test(
name => 'caret',
build => {
class => 'Moonshine::Bootstrap::v3::Dropdown',
},
instructions => [
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
action => 'linked_li',
link => 'http://second.url',
data => 'Second',
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropdown"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul c...
}
],
},
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
action => 'linked_li',
link => 'http://second.url',
data => 'Second',
disable => 1,
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropdown"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul c...
}
],
},
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
data => 'Second',
action => 'dropdown_header_li',
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropdown"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul c...
}
],
},
{
test => 'obj',
func => 'dropdown',
args => {
mid => 'dropdownMenu1',
dropup => 1,
ul => {
separators => [ 1, 3, 5 ],
children => [
{
action => 'linked_li',
link => 'http://some.url',
data => 'URL',
},
{
data => 'Second',
action => 'dropdown_header_li',
}
],
},
button => {
id => 'dropdownMenu1',
data => 'Dropdown',
},
},
expected => 'Moonshine::Element',
subtest => [
{
test => 'render',
expected => '<div class="dropup"><button class="dropdown-toggle btn btn-default" id="dropdownMenu1" type="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown">Dropdown<span class="caret"></span></button><ul cla...
}
],
}
],
);
sunrise();
( run in 2.032 seconds using v1.01-cache-2.11-cpan-364913b4093 )