├── Ch6_Code_Practical_Svelte ├── contact form │ ├── contact - markup block.txt │ └── contact - script block.txt ├── one at a time │ └── audio player code.txt └── coffee selector │ └── app.svelte.txt ├── .gitattributes ├── 9781484273739.jpg ├── Ch1_Code_Practical_Svelte ├── .gitignore ├── public │ ├── favicon.png │ ├── index.html │ └── global.css ├── src │ ├── main.js │ └── App.svelte ├── package.json ├── rollup.config.js ├── README.md ├── scripts │ └── setupTypeScript.js └── package-lock.json ├── Ch5_Code_Practical_Svelte ├── adding a modal │ ├── styling.txt │ └── home.svelte.txt ├── forwarding events │ ├── outer.svelte.txt │ ├── app.svelte.txt │ └── inner.svelte.txt ├── instrumenting the DOM │ ├── app.svelte - markup.txt │ └── app.svelte.txt ├── exploring event handlers │ └── app.svelte.txt ├── creating custom actions - part 2 │ └── app.svelte.txt ├── adding event modifiers │ ├── app.svelte - markup.txt │ ├── app.svelte.txt │ └── app.svelte - styling.txt ├── lifecycle methods - part 2 │ └── app.svelte.txt ├── creating custom actions - part 1 │ └── app.svelte.txt └── lifecycle methods - part 1 │ └── app.svelte.txt ├── Ch2_Code_Practical_Svelte ├── images │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── cart.png │ ├── logo.png │ ├── trash.png │ ├── 1_large.png │ ├── 2_large.png │ ├── 3_large.png │ ├── 4_large.png │ ├── 5_large.png │ ├── 6_large.png │ ├── banner.jpg │ ├── instagram.svg │ ├── facebook.svg │ ├── twitter.svg │ ├── shoppingcart.svg │ └── logo.svg └── src │ ├── components │ ├── Button.svelte │ ├── CartLength.svelte │ ├── index.js │ ├── Header.svelte │ ├── Footer.svelte │ ├── Products.svelte │ ├── Product.svelte │ └── Cart.svelte │ ├── App.svelte │ └── pages │ ├── About.svelte │ ├── Coffee.svelte │ └── Home.svelte ├── Ch3_Code_Practical_Svelte ├── operating stores │ ├── stores.js.txt │ └── app.svelte.txt ├── passing props │ ├── button.svelte.txt │ └── app.svelte.txt ├── making use of context │ ├── child.svelte.txt │ └── app.svelte.txt └── adding derived stores │ ├── Header.svelte - updated version.txt │ └── stores.js - updated version.txt ├── Ch9_Code_Practical_Svelte ├── Demo banner │ ├── Demo banner - markup.txt │ └── Demo banner - styling.txt └── Automating deployment │ └── ghpages.txt ├── Ch11_Code_Practical_Svelte ├── custom easing using css │ ├── app.svelte - markup.txt │ └── app.svelte - css.txt ├── modal fade │ └── Modal.svelte.txt ├── image carousel │ └── Carousel.svelte.txt ├── learning a language │ └── App.svelte.txt └── custom easing using js │ └── demo custom easing.txt ├── Ch4_Code_Practical_Svelte ├── sourcing fake products │ ├── app.svelte.txt │ ├── app.svelte - markup.txt │ └── app.svelte - style.txt ├── creating a qr code │ ├── app.svelte - markup.txt │ └── app.svelte.txt ├── iterating through each block │ ├── app.svelte.txt │ ├── app.svelte - style.txt │ └── app.svelte - markup.txt ├── loading products │ └── code.txt ├── removing a selected item │ ├── app.svelte - style.txt │ ├── app.svelte.txt │ └── app.svelte - markup.txt └── adding login & out links │ └── code.txt ├── errata.md ├── Ch7_Code_Practical_Svelte ├── Fixing the errors │ └── Replacement Route block.txt ├── 3A - Header & footer │ ├── footer styling.txt │ ├── header markup.txt │ └── header styling.txt ├── 3C - Products, Product Pages and Cart │ ├── replacement each block code.txt │ ├── styling - product page.txt │ ├── styling - products page.txt │ └── styling - cart.txt ├── 3B - Buttons │ └── Button styling.txt ├── 2 - Pages │ └── Styling pages.txt ├── Preprocessing │ └── various code steps.txt └── 1 - Global styles │ └── Global styles.txt ├── Ch8_Code_Practical_Svelte ├── website tests │ ├── TestingStores.spec.js │ ├── ContentPages.spec.js │ ├── HomePage.spec.js │ └── Shop.spec.js ├── installing cypress │ └── installing cypress - code steps.txt ├── debugging svelte │ └── app.svelte.txt └── example test │ └── example1.spec.js ├── Ch12_Code_Practical_Svelte ├── taking it further │ └── __error.svelte.txt ├── layout template │ └── __layout.svelte └── styles │ └── styles.css ├── README.md ├── Contributing.md └── LICENSE.txt /Ch6_Code_Practical_Svelte/contact form/contact - markup block.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /9781484273739.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/9781484273739.jpg -------------------------------------------------------------------------------- /Ch1_Code_Practical_Svelte/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/adding a modal/styling.txt: -------------------------------------------------------------------------------- 1 | .modal-background { background-color: rgba(0, 0, 0, .7) !important; } -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/1.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/2.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/3.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/4.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/5.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/6.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/cart.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/logo.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/trash.png -------------------------------------------------------------------------------- /Ch1_Code_Practical_Svelte/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch1_Code_Practical_Svelte/public/favicon.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/1_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/1_large.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/2_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/2_large.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/3_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/3_large.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/4_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/4_large.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/5_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/5_large.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/6_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/6_large.png -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/images/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Apress/practical-svelte/HEAD/Ch2_Code_Practical_Svelte/images/banner.jpg -------------------------------------------------------------------------------- /Ch3_Code_Practical_Svelte/operating stores/stores.js.txt: -------------------------------------------------------------------------------- 1 | import { writable } from 'svelte/store' 2 | export const username = writable('Guest'); 3 | -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/src/components/Button.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/forwarding events/outer.svelte.txt: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Ch9_Code_Practical_Svelte/Demo banner/Demo banner - markup.txt: -------------------------------------------------------------------------------- 1 | 2 | This is a test site only - please note that no orders will be accepted 3 | 4 | -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/src/components/CartLength.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |

There are {$cart.length} items in your cart

-------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/instrumenting the DOM/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /Ch3_Code_Practical_Svelte/passing props/button.svelte.txt: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/instrumenting the DOM/app.svelte.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Ch1_Code_Practical_Svelte/src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ 4 | target: document.body, 5 | props: { 6 | name: 'world' 7 | } 8 | }); 9 | 10 | export default app; -------------------------------------------------------------------------------- /Ch11_Code_Practical_Svelte/custom easing using css/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 |

2 | Transform a box using custom CSS 3 |

4 |
5 |
6 | CSS 7 |
8 |
9 | -------------------------------------------------------------------------------- /Ch3_Code_Practical_Svelte/making use of context/child.svelte.txt: -------------------------------------------------------------------------------- 1 | 5 | 6 |

7 | This is the {$state.color} value 8 |

9 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/exploring event handlers/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/creating custom actions - part 2/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 6 | 7 |

Hello Action!

8 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/sourcing fake products/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/creating a qr code/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 |

2 | A Random QR Code... 3 |

4 | {#if textPresent} 5 | qr-code
6 | {:else} 7 |

8 | Are you sure you can see me? 9 |

10 | {/if} 11 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/iterating through each block/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/forwarding events/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/loading products/code.txt: -------------------------------------------------------------------------------- 1 | npm install "@rollup/plugin-json" --save 2 | 3 | 4 | import * as myjson from '../public/stock.json'; 5 | 6 | 7 | {#await $products} 8 |

...loading products

9 | {:then} 10 | 11 | {/await} 12 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/adding event modifiers/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 |
console.log('Outer div')}> 2 |

Outer div

3 |
console.log 4 | ('inner div')}> 5 |

Inner div

6 |
7 |
8 | -------------------------------------------------------------------------------- /Ch9_Code_Practical_Svelte/Demo banner/Demo banner - styling.txt: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /errata.md: -------------------------------------------------------------------------------- 1 | # Errata for *Practical Svelte* 2 | 3 | On **page xx** [Summary of error]: 4 | 5 | Details of error here. Highlight key pieces in **bold**. 6 | 7 | *** 8 | 9 | On **page xx** [Summary of error]: 10 | 11 | Details of error here. Highlight key pieces in **bold**. 12 | 13 | *** -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/sourcing fake products/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 |

My Fake Store

2 | 3 | {#await fetchImage} 4 |

...loading products

5 | {:then data} 6 |
7 | product 8 | {data.title} 9 |
10 | {/await} 11 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/adding event modifiers/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 | 9 | 10 |
11 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/adding a modal/home.svelte.txt: -------------------------------------------------------------------------------- 1 | 2 |

Get 10% off your first order!

3 |

4 | Use code 10PERCENT at checkout 5 | image3 6 |

7 | 8 |
9 | 10 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/creating a qr code/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /Ch7_Code_Practical_Svelte/Fixing the errors/Replacement Route block.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/adding event modifiers/app.svelte - styling.txt: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /Ch2_Code_Practical_Svelte/src/components/index.js: -------------------------------------------------------------------------------- 1 | import Products from "./Products.svelte"; 2 | import Footer from "./Footer.svelte"; 3 | import Header from "./Header.svelte"; 4 | import Product from "./Product.svelte"; 5 | import CartLength from "./CartLength.svelte"; 6 | import Cart from "./Cart.svelte"; 7 | 8 | export { Products, Footer, Header, Product, CartLength, Cart } -------------------------------------------------------------------------------- /Ch8_Code_Practical_Svelte/website tests/TestingStores.spec.js: -------------------------------------------------------------------------------- 1 | const getStore = () => cy.window().its('app.store') 2 | 3 | describe('Testing stores in app', () => { 4 | it('can render correct value from product listing', () => { 5 | getStore().then(store => { 6 | store.set({ name: 'xxxxxx' }) 7 | }) 8 | 9 | cy.contains('XXX', 'XXXXXX!') 10 | }) 11 | }) -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/lifecycle methods - part 2/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |

{count}

12 | 13 |
14 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/creating custom actions - part 1/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 13 | 14 |

Hello onMount!

15 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/forwarding events/inner.svelte.txt: -------------------------------------------------------------------------------- 1 | 12 | 13 | 16 | -------------------------------------------------------------------------------- /Ch3_Code_Practical_Svelte/making use of context/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Ch8_Code_Practical_Svelte/installing cypress/installing cypress - code steps.txt: -------------------------------------------------------------------------------- 1 | files:module.exports = (on) => { 2 | const filePreprocessor = require('@bahmutov/cy-rollup') 3 | on('file:preprocessor', filePreprocessor()) 4 | } 5 | 6 | 7 | { 8 | "experimentalComponentTesting": true, 9 | "componentFolder": "./src/components", 10 | "testFiles": "**/*spec.js" 11 | } 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/iterating through each block/app.svelte - style.txt: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /Ch3_Code_Practical_Svelte/operating stores/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 12 |

13 | Hello, {newUsername}! 14 |

15 | -------------------------------------------------------------------------------- /Ch12_Code_Practical_Svelte/taking it further/__error.svelte.txt: -------------------------------------------------------------------------------- 1 | 10 | 11 | 14 | 15 | 16 | {title} 17 | 18 | 19 |

{title}

-------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/removing a selected item/app.svelte - style.txt: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/iterating through each block/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 |

Coffees for Sale

2 | 14 | -------------------------------------------------------------------------------- /Ch9_Code_Practical_Svelte/Automating deployment/ghpages.txt: -------------------------------------------------------------------------------- 1 | var ghpages = require('gh-pages'); 2 | 3 | ghpages.publish( 4 | 'public', // path to public directory 5 | { 6 | branch: 'gh-pages', 7 | repo: 'https://github.com/username/ 8 | yourproject.git', 9 | user: { 10 | name: '', 11 | email: '' 12 | } 13 | }, 14 | () => { 15 | console.log('Deploy Complete!') 16 | } 17 | ) 18 | -------------------------------------------------------------------------------- /Ch7_Code_Practical_Svelte/3A - Header & footer/footer styling.txt: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/removing a selected item/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /Ch1_Code_Practical_Svelte/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte app 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Ch8_Code_Practical_Svelte/debugging svelte/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {@debug user, fruit} 20 | 21 |

Hello {user.firstname}!

22 |

23 | Price of {fruit.name}: {fruit.price} 24 |

-------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/removing a selected item/app.svelte - markup.txt: -------------------------------------------------------------------------------- 1 |

Coffees for Sale

2 | 5 | 17 | -------------------------------------------------------------------------------- /Ch7_Code_Practical_Svelte/3C - Products, Product Pages and Cart/replacement each block code.txt: -------------------------------------------------------------------------------- 1 | {#each $products as product} 2 |
3 |
4 |

5 | {product.name}

6 |

${product.price}

7 |
8 | addToCart(product)}> 9 | Add to cart 10 | 11 |
12 |
13 | {/each} 14 | -------------------------------------------------------------------------------- /Ch4_Code_Practical_Svelte/sourcing fake products/app.svelte - style.txt: -------------------------------------------------------------------------------- 1 | 27 | -------------------------------------------------------------------------------- /Ch5_Code_Practical_Svelte/lifecycle methods - part 1/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 11 | 12 | 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Apress Source Code 2 | 3 | This repository accompanies [*Practical Svelte*](https://www.apress.com/9781484273739) by Alex Libby (Apress, 2022). 4 | 5 | [comment]: #cover 6 | ![Cover image](9781484273739.jpg) 7 | 8 | Download the files as a zip using the green button, or clone the repository to your machine using Git. 9 | 10 | ## Releases 11 | 12 | Release v1.0 corresponds to the code in the published book, without corrections or updates. 13 | 14 | ## Contributions 15 | 16 | See the file Contributing.md for more information on how you can contribute to this repository. -------------------------------------------------------------------------------- /Ch7_Code_Practical_Svelte/3A - Header & footer/header markup.txt: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | Small Coffee Company 5 |
6 |
7 |
8 | {#if loggedIn} 9 |
Hi, {name} | Logout
10 | {:else} 11 |
Hi, Guest | Login
12 | {/if} 13 |
14 |
15 |
{$cart.length} items: ${$totalprice}
16 |
17 |
-------------------------------------------------------------------------------- /Ch7_Code_Practical_Svelte/3C - Products, Product Pages and Cart/styling - product page.txt: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /Ch7_Code_Practical_Svelte/3B - Buttons/Button styling.txt: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /Ch1_Code_Practical_Svelte/src/App.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |

Hello {name}!

7 |

Visit the Svelte tutorial to learn how to build Svelte apps.

8 |
9 | 10 | -------------------------------------------------------------------------------- /Ch3_Code_Practical_Svelte/passing props/app.svelte.txt: -------------------------------------------------------------------------------- 1 | 15 | 16 |
17 |

Get me on social media!

18 |
22 | -------------------------------------------------------------------------------- /Ch8_Code_Practical_Svelte/example test/example1.spec.js: -------------------------------------------------------------------------------- 1 | beforeEach(() => { 2 | cy.visit("https://svelte.dev"); 3 | }) 4 | 5 | describe('Testing Svelte website front page', () => { 6 | it('shows 3 boxes', () => { 7 | cy.get('.box').should('have.length', 3); 8 | }) 9 | 10 | it('each box is of a different color', () => { 11 | cy.get('.box:nth-child(1)').should('have.css', 'background-color', 'rgb(255, 62, 0)') 12 | cy.get('.box:nth-child(2)').should('have.css', 'background-color', 'rgb(64, 179, 255)') 13 | cy.get('.box:nth-child(3)').should('have.css', 'background-color', 'rgb(103, 103, 120)') 14 | }); 15 | }) 16 | -------------------------------------------------------------------------------- /Ch12_Code_Practical_Svelte/layout template/__layout.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 | 9 | 18 |
19 | 20 |
21 |