mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 11:58:51 +00:00
[ticket/17151] Fix tests
PHPBB3-17151
This commit is contained in:
parent
52517a5efd
commit
7b04e411b6
6 changed files with 180 additions and 24 deletions
|
@ -970,10 +970,10 @@ class acp_board
|
|||
{
|
||||
list($available, $value) = $data;
|
||||
$act_options[] = [
|
||||
'value' => $value,
|
||||
'selected' => $selected_value == $value,
|
||||
'label' => $user->lang($key),
|
||||
'disabled' => !$available,
|
||||
'value' => $value,
|
||||
'selected' => $selected_value == $value,
|
||||
'label' => $user->lang($key),
|
||||
'class' => !$available ? 'disabled-option' : '',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
<option
|
||||
value="{{ option.value }}"
|
||||
{% if option.selected %}selected="selected"{% endif %}
|
||||
{% if option.disabled %} disabled="disabled" class="disabled-option"{% endif %}>{{ option.label }}</option>
|
||||
{% if option.disabled %} disabled="disabled"{% endif %}{% if option.class %} class="{{ option.class }}"{% endif %}>{{ option.label }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% else %}
|
||||
<option
|
||||
value="{{ element.value }}"
|
||||
{% if element.selected %} selected="selected"{% endif %}
|
||||
{% if element.disabled %} disabled="disabled" class="disabled-option"{% endif %}
|
||||
{% if element.disabled %} disabled="disabled"{% endif %}{% if element.class %} class="{{ element.class }}"{% endif %}
|
||||
{% if element.data %}{% for key, value in element.data %} data-{{ key }}="{{ value }}"{% endfor %}{% endif %}>{{ element.label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -22,8 +22,36 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case
|
|||
public static function select_auth_method_data()
|
||||
{
|
||||
return [
|
||||
['acp_board_valid', '<option value="acp_board_valid" selected="selected" data-toggle-setting="#auth_acp_board_valid_settings">Acp_board_valid</option>'],
|
||||
['acp_board_invalid', '<option value="acp_board_valid" data-toggle-setting="#auth_acp_board_valid_settings">Acp_board_valid</option>'],
|
||||
[
|
||||
'acp_board_valid',
|
||||
[
|
||||
'options' => [
|
||||
0 => [
|
||||
'value' => 'acp_board_valid',
|
||||
'label' => 'Acp_board_valid',
|
||||
'selected' => true,
|
||||
'data' => [
|
||||
'toggle-setting' => '#auth_acp_board_valid_settings',
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'acp_board_invalid',
|
||||
[
|
||||
'options' => [
|
||||
0 => [
|
||||
'value' => 'acp_board_valid',
|
||||
'label' => 'Acp_board_valid',
|
||||
'selected' => false,
|
||||
'data' => [
|
||||
'toggle-setting' => '#auth_acp_board_valid_settings',
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -125,11 +125,25 @@ class main_module
|
|||
|
||||
function create_select()
|
||||
{
|
||||
return '
|
||||
<option value="1" selected="selected">Option 1</option>
|
||||
<option value="2">Option 2</option>
|
||||
<option value="3">Option 3</option>
|
||||
';
|
||||
return [
|
||||
'options' => [
|
||||
[
|
||||
'value' => 1,
|
||||
'selected' => true,
|
||||
'label' => 'Option 1',
|
||||
],
|
||||
[
|
||||
'value' => 2,
|
||||
'selected' => false,
|
||||
'label' => 'Option 2',
|
||||
],
|
||||
[
|
||||
'value' => 3,
|
||||
'selected' => false,
|
||||
'label' => 'Option 3',
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
function submit_button()
|
||||
|
|
|
@ -20,14 +20,119 @@ class phpbb_functions_style_select_test extends phpbb_database_test_case
|
|||
|
||||
static public function style_select_data()
|
||||
{
|
||||
return array(
|
||||
array('', false, '<option value="1">prosilver</option><option value="2">subsilver2</option>'),
|
||||
array('', true, '<option value="1">prosilver</option><option value="2">subsilver2</option><option value="3">zoo</option>'),
|
||||
array('1', false, '<option value="1" selected="selected">prosilver</option><option value="2">subsilver2</option>'),
|
||||
array('1', true, '<option value="1" selected="selected">prosilver</option><option value="2">subsilver2</option><option value="3">zoo</option>'),
|
||||
array('3', false, '<option value="1">prosilver</option><option value="2">subsilver2</option>'),
|
||||
array('3', true, '<option value="1">prosilver</option><option value="2">subsilver2</option><option value="3" selected="selected">zoo</option>'),
|
||||
);
|
||||
return [
|
||||
[
|
||||
'',
|
||||
false,
|
||||
[
|
||||
[
|
||||
'value' => '1',
|
||||
'selected' => false,
|
||||
'label' => 'prosilver',
|
||||
],
|
||||
[
|
||||
'value' => '2',
|
||||
'selected' => false,
|
||||
'label' => 'subsilver2',
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'',
|
||||
true,
|
||||
[
|
||||
[
|
||||
'value' => '1',
|
||||
'selected' => false,
|
||||
'label' => 'prosilver',
|
||||
],
|
||||
[
|
||||
'value' => '2',
|
||||
'selected' => false,
|
||||
'label' => 'subsilver2',
|
||||
],
|
||||
[
|
||||
'value' => '3',
|
||||
'selected' => false,
|
||||
'label' => 'zoo',
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'1',
|
||||
false,
|
||||
[
|
||||
[
|
||||
'value' => '1',
|
||||
'selected' => true,
|
||||
'label' => 'prosilver',
|
||||
],
|
||||
[
|
||||
'value' => '2',
|
||||
'selected' => false,
|
||||
'label' => 'subsilver2',
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'1',
|
||||
true,
|
||||
[
|
||||
[
|
||||
'value' => '1',
|
||||
'selected' => true,
|
||||
'label' => 'prosilver',
|
||||
],
|
||||
[
|
||||
'value' => '2',
|
||||
'selected' => false,
|
||||
'label' => 'subsilver2',
|
||||
],
|
||||
[
|
||||
'value' => '3',
|
||||
'selected' => false,
|
||||
'label' => 'zoo',
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'3',
|
||||
false,
|
||||
[
|
||||
[
|
||||
'value' => '1',
|
||||
'selected' => false,
|
||||
'label' => 'prosilver',
|
||||
],
|
||||
[
|
||||
'value' => '2',
|
||||
'selected' => false,
|
||||
'label' => 'subsilver2',
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'3',
|
||||
true,
|
||||
[
|
||||
[
|
||||
'value' => '1',
|
||||
'selected' => false,
|
||||
'label' => 'prosilver',
|
||||
],
|
||||
[
|
||||
'value' => '2',
|
||||
'selected' => false,
|
||||
'label' => 'subsilver2',
|
||||
],
|
||||
[
|
||||
'value' => '3',
|
||||
'selected' => true,
|
||||
'label' => 'zoo',
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -431,8 +431,11 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
|||
['method' => 'select_helper'],
|
||||
[
|
||||
'tag' => 'select',
|
||||
'class' => false,
|
||||
'id' => 'key_name',
|
||||
'data' => [],
|
||||
'name' => 'config[config_key_name]',
|
||||
'toggleable' => false,
|
||||
'options' => [
|
||||
[
|
||||
'value' => 1,
|
||||
|
@ -450,7 +453,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
|||
'selected' => false,
|
||||
]
|
||||
],
|
||||
'toggleable' => false,
|
||||
'group_only' => false,
|
||||
'size' => 1,
|
||||
'multiple' => false,
|
||||
],
|
||||
],
|
||||
[
|
||||
|
@ -461,9 +466,11 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
|||
['method' => 'select_helper'],
|
||||
[
|
||||
'tag' => 'select',
|
||||
'class' => false,
|
||||
'id' => 'key_name',
|
||||
'data' => [],
|
||||
'name' => 'config[config_key_name]',
|
||||
'size' => 8,
|
||||
'toggleable' => false,
|
||||
'options' => [
|
||||
[
|
||||
'value' => 1,
|
||||
|
@ -481,7 +488,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
|||
'selected' => false,
|
||||
]
|
||||
],
|
||||
'toggleable' => false,
|
||||
'group_only' => false,
|
||||
'size' => 8,
|
||||
'multiple' => false,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Add table
Reference in a new issue