This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
... | |
"outDir": "./lib", | |
... | |
}, | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-lib", | |
"version": "0.0.1", | |
"description": "My Lib description", | |
"files": [ | |
"lib/**/*" | |
], | |
"main": "lib/index.js", | |
"types": "lib/index.d.ts", | |
"scripts": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { css, html, LitElement } from 'lit'; | |
import { sharedStyles } from './shared/style'; | |
const componentStyle = css` | |
.cards > ul { | |
list-style: none; | |
margin: 0; | |
padding: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { html, LitElement } from 'lit'; | |
import { repeat } from 'lit/directives/repeat.js'; | |
@customElement('cards-images') | |
export class Cards extends LitElement { | |
... | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { customElement, property } from 'lit/decorators.js'; | |
@customElement('cards-images') | |
export class Cards extends LitElement { | |
@property({ type: Array }) cards!: CardConfig[]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { LitElement } from 'lit'; | |
import { customElement } from 'lit/decorators.js'; | |
@customElement('cards-images') | |
export class Cards extends LitElement {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
describe('Card Component', () => { | |
... | |
it('it renders the image', () => { | |
const image = el.shadowRoot?.querySelector('img'); | |
expect(image).to.exist; | |
expect(image?.alt).to.equal(card.altText); | |
expect(image?.src).to.equal(card.image); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { assert, expect, fixture, html } from '@open-wc/testing'; | |
describe('Card Component', () => { | |
... | |
beforeEach(async () => { | |
el = await fixture<Card>(html` <card-image .card=${card}></card-image> `); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Card } from './card'; | |
describe('Card Component', () => { | |
let el: Card; | |
const card = { | |
altText: 'Je suis a image', | |
ctaText: 'Click me', | |
image: 'http://example.com/image/', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@customElement('card-image') | |
export class Card extends LitElement { | |
... | |
@query('#card-link') cardLinkEl!: HTMLAnchorElement; | |
render() { | |
return html` | |
<li class="card"> | |
<div class="img"> |
NewerOlder