diff --git a/src/Helper/Fields/Field_Products.php b/src/Helper/Fields/Field_Products.php index 366bf8405..8a89b59f8 100644 --- a/src/Helper/Fields/Field_Products.php +++ b/src/Helper/Fields/Field_Products.php @@ -153,7 +153,7 @@ public function html( $value = '', $label = true ) {
- +
-
  • +
  • @@ -197,7 +197,7 @@ public function html( $value = '', $label = true ) { rowspan="get_order_summary_item_count( $order_summary ) ); ?>"> "> - + "> @@ -216,7 +216,7 @@ class="subtotal totals"> + class="shipping totals"> diff --git a/tests/phpunit/unit-tests/Helper/Fields/Test_Field_Products.php b/tests/phpunit/unit-tests/Helper/Fields/Test_Field_Products.php index eee654c41..bf06c14e8 100644 --- a/tests/phpunit/unit-tests/Helper/Fields/Test_Field_Products.php +++ b/tests/phpunit/unit-tests/Helper/Fields/Test_Field_Products.php @@ -60,5 +60,31 @@ public function test_value() { $this->assertArrayHasKey( 'subtotal_formatted', $value['products'][34] ); } + public function test_html() { + $html = $this->pdf_field->html(); + + $this->assertStringContainsString( '
  • Product Options for Basic Product: Option 2
  • ', $html ); + $this->assertStringContainsString( 'Calculation Price', $html ); + $this->assertStringContainsString( '
  • Option for Calculation Price: Cal - Option 1
  • ', $html ); + $this->assertStringContainsString( '$860.25', $html ); + } + + public function test_labels_in_html() { + $products = \GFCommon::get_product_fields( $this->form, $this->entry ); + $products['products'][34]['name'] = 'Product Basic'; + $products['products'][34]['options'][0]['option_label'] = ' Option 2'; + + $use_choice_text = true; + $use_admin_label = false; + gform_update_meta( $this->pdf_field->entry['id'], "gform_product_info_{$use_choice_text}_{$use_admin_label}", $products, $this->form['id'] ); + + $html = $this->pdf_field->html(); + + $this->assertStringContainsString( 'Product Basic', $html ); + $this->assertStringContainsString( '
  • Option 2
  • ', $html ); + $this->assertStringContainsString( 'Calculation Price', $html ); + $this->assertStringContainsString( '
  • Option for Calculation Price: Cal - Option 1
  • ', $html ); + $this->assertStringContainsString( '$860.25', $html ); + } }