Integration Guides

croissant-toggle

Initialization

Test Case: Verify Initial Quantity and Product-ID

Description: After the page loads, the "Croissant Toggle" should initialize with a specific quantity and product-id based on the first size option available.

Assertion:

  • Assert that the quantity attribute of the "Croissant Toggle" is set to 1.
  • Assert that the product-id attribute of the "Croissant Toggle" matches the data-sku value of the first size option.

Test Case: Verify Initial Resale Value

Description: Ensure that the resale value displayed on initialization is correct for the given product-id.

Assertion:

  • Assert that the Croissant Resale value displayed matches the expected value for the initial product-id.

Quantity Increment

Test Case: Increment Quantity

Description: Verify that clicking the increment button increases the quantity by 1.

Assertion:

  • Click the increment button.
  • Assert that the quantity attribute of the "Croissant Toggle" increases by 1.

Test Case: Verify Resale Value After Increment

Description: Ensure that the resale value updates correctly when the quantity is incremented.

Assertion:

  • Increment the quantity.
  • Assert that the Croissant Resale value displayed is equal to the resale value for the product-id times the new quantity.

Quantity Decrement

Test Case: Decrement Quantity

Description: Ensure the quantity decrements correctly without going below 1.

Assertion:

  • Click the decrement button when the quantity is greater than 1.
  • Assert that the quantity attribute of the "Croissant Toggle" decreases by 1.
  • Attempt to decrement when the quantity is 1 and assert the quantity does not change.

Test Case: Update Product-ID on Size Selection

Description: Verify that selecting a size option updates the product-id attribute correctly.

Assertion:

  • For each size option, click the size option button.
  • Assert that the product-id attribute of the "Croissant Toggle" updates to match the data-sku of the selected size option.

Simultaneous Update

Test Case: Simultaneous Size and Quantity Update

Description: Verify that changing the size and quantity simultaneously updates the product-id and quantity attributes correctly.

Assertion:

  • Change the size option and increment/decrement the quantity.
  • Assert that both the product-id and quantity attributes of the "Croissant Toggle" are updated correctly and that the Croissant Resale value displayed matches the expected calculation.