Skip to content

Commit 6752d26

Browse files
committed
replace main content with challenge content
1 parent c7df0f7 commit 6752d26

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

src/VernierApp.js

+22-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { LitElement, html, css } from 'lit';
2-
3-
const logo = new URL('../assets/open-wc-logo.svg', import.meta.url).href;
2+
import { until } from 'lit/directives/until.js';
43

54
export class VernierApp extends LitElement {
65
static get properties() {
@@ -21,7 +20,6 @@ export class VernierApp extends LitElement {
2120
color: #1a2b42;
2221
max-width: 960px;
2322
margin: 0 auto;
24-
text-align: center;
2523
background-color: var(--vernier-app-background-color);
2624
}
2725
@@ -54,37 +52,36 @@ export class VernierApp extends LitElement {
5452
`;
5553
}
5654

55+
/**
56+
* List of recent natural events from NASA's EONET
57+
*
58+
* @return {Element}
59+
*/
60+
static async makeNaturalEventsList() {
61+
const eventsData = await (await fetch('https://eonet.gsfc.nasa.gov/api/v3/events?limit=15')).json();
62+
const events = eventsData.events.map(event => html`
63+
<li>${event.title}</li>
64+
`);
65+
66+
return html`
67+
<ol id="trends-list">
68+
${events}
69+
</ol>
70+
<p>Thanks, <a href="https://eonet.gsfc.nasa.gov/what-is-eonet">EONET</a>!</p>
71+
`;
72+
}
73+
5774
constructor() {
5875
super();
59-
this.title = 'My app';
76+
this.title = 'Natural Events';
6077
}
6178

6279
render() {
6380
return html`
6481
<main>
65-
<div class="logo"><img alt="open-wc logo" src=${logo} /></div>
6682
<h1>${this.title}</h1>
67-
68-
<p>Edit <code>src/VernierApp.js</code> and save to reload.</p>
69-
<a
70-
class="app-link"
71-
href="https://open-wc.org/guides/developing-components/code-examples/"
72-
target="_blank"
73-
rel="noopener noreferrer"
74-
>
75-
Code examples
76-
</a>
83+
${until(VernierApp.makeNaturalEventsList(), html`Loading...`)}
7784
</main>
78-
79-
<p class="app-footer">
80-
🚽 Made with love by
81-
<a
82-
target="_blank"
83-
rel="noopener noreferrer"
84-
href="https://github.com/open-wc"
85-
>open-wc</a
86-
>.
87-
</p>
8885
`;
8986
}
9087
}

test/vernier-app.test.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { html } from 'lit';
2-
import { fixture, expect } from '@open-wc/testing';
2+
import { fixture, expect, waitUntil } from '@open-wc/testing';
33

44
import '../src/vernier-app.js';
55

@@ -12,7 +12,11 @@ describe('VernierApp', () => {
1212
it('renders a h1', () => {
1313
const h1 = element.shadowRoot.querySelector('h1');
1414
expect(h1).to.exist;
15-
expect(h1.textContent).to.equal('My app');
15+
expect(h1.textContent).to.equal('Natural Events');
16+
});
17+
18+
it('renders a list of 15 natural event titles', async () => {
19+
// Complete this test
1620
});
1721

1822
it('passes the a11y audit', async () => {

0 commit comments

Comments
 (0)