@@ -233,6 +233,34 @@ describe('Render Product HTML', () => {
233
233
} ) ;
234
234
} ) ;
235
235
236
+ it ( 'should not render product options table if there are none' , ( ) => {
237
+ product . options = [ ] ;
238
+ const html = htmlTemplateFromContext ( DEFAULT_CONTEXT ( { config } ) , product , variations ) . render ( ) ;
239
+ dom = new JSDOM ( html ) ;
240
+ document = dom . window . document ;
241
+
242
+ const optionsTable = document . querySelector ( '.product-options' ) ;
243
+ assert . strictEqual ( optionsTable , null , 'Options table should not be rendered' ) ;
244
+ } ) ;
245
+
246
+ it ( 'should not render product variants table if there are none' , ( ) => {
247
+ variations = [ ] ;
248
+ const html = htmlTemplateFromContext ( DEFAULT_CONTEXT ( { config } ) , product , variations ) . render ( ) ;
249
+ dom = new JSDOM ( html ) ;
250
+ document = dom . window . document ;
251
+
252
+ const variantsTable = document . querySelector ( '.product-variants' ) ;
253
+ assert . strictEqual ( variantsTable , null , 'Variants table should not be rendered' ) ;
254
+ } ) ;
255
+
256
+ it ( 'should not render variant attributes table if there are none' , ( ) => {
257
+ const html = htmlTemplateFromContext ( DEFAULT_CONTEXT ( { config } ) , product , [ ] ) . render ( ) ;
258
+ dom = new JSDOM ( html ) ;
259
+ document = dom . window . document ;
260
+ const variantAttributesTable = document . querySelector ( '.variant-attributes' ) ;
261
+ assert . strictEqual ( variantAttributesTable , null , 'Variant attributes table should not be rendered' ) ;
262
+ } ) ;
263
+
236
264
it ( 'template should allow for missing prices' , ( ) => {
237
265
config . confMap = {
238
266
'/us/p/{{urlkey}}/{{sku}}' : { } ,
0 commit comments