Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zero Test - Move
- document.body.innerHTML = `
- <h1>Ski Inventory</h1>
- <section id="products">
- <h2>Available Products</h2>
- <ul>
- </ul>
- <div class="filter">
- <label>Filter</label>
- <input id="filter" type="text" placeholder="Search by name..." />
- <button>Filter</button>
- </div>
- </section>
- <form id="add-new">
- <h2>Add Product</h2>
- <input type="text" placeholder="Name" />
- <input type="text" placeholder="Quantity" />
- <input type="text" placeholder="Price" />
- <button>Add</button>
- </form>
- <h1>Total Price: 00.00</h1>
- <section id="myProducts">
- <h2>My Products</h2>
- <ul>
- </ul>
- <button>Buy</button>
- </section>
- `;
- result();
- let inputFields = document.querySelectorAll('form input');
- let formButton = document.querySelector('form button');
- let sections = document.querySelector('section');
- inputFields[0].value = 'Dynamic Slalom Carver';
- inputFields[1].value = "3";
- inputFields[2].value = '55.50';
- formButton.click();
- //Add to new Books
- let avProducts = document.querySelectorAll("#products ul li");
- let available = avProducts[0].children[1];
- let addBtn = avProducts[0].children[2].children[1];
- //Move
- addBtn.click();
- assert.equal(available.textContent,"Available: 2","Quantity is incorrect");
- let totalPrice = document.querySelectorAll('h1')[1];
- assert.equal(totalPrice.textContent, "Total Price: 55.50", "Total price is incorrect");
- //MyProducts Structure
- let myProducts = document.querySelectorAll('#myProducts ul li');
- assert.equal(myProducts[0].children.length,1,"my products structure is incorrect");
- assert.equal(myProducts[0].children[0].tagName,"STRONG","strong in my products is incorrect");
- assert.equal(myProducts[0].textContent,"Dynamic Slalom Carver55.50","My products text is incorrect");
Advertisement
Add Comment
Please, Sign In to add comment