Test code updated, with thanks to @ObliviousHarmony

This commit is contained in:
Mike Dent 2020-07-20 15:45:13 +01:00
parent 53d9085c16
commit 541f68363e
2 changed files with 5 additions and 2 deletions

View File

@ -2770,7 +2770,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
break;
case 'hidden':
$field .= '<input type="' . esc_attr( $args['type'] ) . '" class="input-hidden ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
$field .= '<input type="' . esc_attr( $args['type'] ) . '" class="input-hidden ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
break;
case 'select':

View File

@ -184,8 +184,11 @@ class WC_Tests_Template_Functions extends WC_Unit_Test_Case {
array(
'type' => 'hidden',
'id' => 'test_field',
'input_class' => array( 'test-field' ),
'custom_attributes' => array( 'data-total' => '10' ),
'return' => true
), 'test value');
$expected_html = '<input type="hidden" class="input-hidden" name="test" id="test_field" value="test value" />';
$expected_html = '<p class="form-row " id="test_field_field" data-priority=""><span class="woocommerce-input-wrapper"><input type="hidden" class="input-hidden test-field" name="test" id="test_field" value="test value" data-total="10" /></span></p>';
$this->assertEquals( $expected_html, $actual_html );