Skip to content

Commit b6f5fbd

Browse files
committed
Merge branch 'develop'
2 parents ac65188 + 60cb911 commit b6f5fbd

File tree

14 files changed

+90
-103
lines changed

14 files changed

+90
-103
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ cd demo
4949

5050
## Test
5151

52-
Until the new web component tester is released - we have to clone and build:
52+
> Warning: Tests are currently failing - selenium is failing to boot chrome. It may be that we have to move away from web-component-tester.
53+
54+
55+
> You'll need to `bower install Polymer/web-component-tester --save` to install wct bower deps.
5356
5457
```shell
55-
git clone [email protected]:Polymer/web-component-tester.git
56-
cd web-component-tester
57-
git checkout v6.0.0-prerelease.6
58-
npm link
59-
# wct is now available as an executable
60-
cd pie-catalog-client
61-
npm test
58+
npm install -g web-component-tester
6259
```
6360

6461
Once it's released we can just add it to the `devDependencies`, and update the npm test cmd.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pie-catalog-client",
3-
"version": "1.5.0",
3+
"version": "2.0.0-prerelease",
44
"description": "The client code for the catalog",
55
"scripts": {
66
"test": "./node_modules/.bin/webpack --config test-build/webpack.config.js && wct",

src/bootstrap/common.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require('./common.less');
2+
3+
import AvatarService from '../avatar-service';
4+
import CatalogContainer from '../catalog-container';
5+
import CatalogFooter from '../footer';
6+
import CatalogHeader from '../header';
7+
import CatalogListing from '../listing';
8+
import CatalogListings from '../listings';
9+
import CatalogOrg from '../org';
10+
import GithubAvatar from '../github-avatar';
11+
import PieBrand from '../pie-brand';
12+
import ProgressBar from '../progress-bar';
13+
14+
export const defineCommonElements = () => {
15+
const elementMap = {
16+
'catalog-listings': CatalogListings,
17+
'catalog-listing': CatalogListing,
18+
'catalog-header': CatalogHeader,
19+
'catalog-footer': CatalogFooter,
20+
'catalog-org': CatalogOrg,
21+
'github-avatar': GithubAvatar,
22+
'pie-brand': PieBrand,
23+
'progress-bar': ProgressBar,
24+
'catalog-container': CatalogContainer,
25+
'avatar-service': AvatarService
26+
}
27+
28+
const keys = Object.keys(elementMap);
29+
30+
keys.forEach(k => {
31+
customElements.define(k, elementMap[k]);
32+
});
33+
34+
const definedPromises = ['catalog-container'].concat(keys).map(k => customElements.whenDefined(k));
35+
36+
return Promise.all(definedPromises);
37+
}
File renamed without changes.

src/bootstrap/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/bootstrap/org.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/bootstrap/repo.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import { VIEW_ORG } from '../events';
2-
import common from '../common';
3-
4-
//Common will resolve first
5-
export { common };
1+
import { defineCommonElements } from './common';
62

73
//logic next
84
export const logic = require.ensure([], () => {
@@ -51,5 +47,10 @@ let repoElements = [
5147
'catalog-demo'
5248
];
5349

50+
5451
//This will happen at the end
55-
export const elementsDefined = Promise.all(repoElements.map(e => customElements.whenDefined(e)));
52+
export const defineRepoElements = () => {
53+
const elementPromises = repoElements.map(e => customElements.whenDefined(e));
54+
const promises = [defineCommonElements()].concat(elementPromises);
55+
return Promise.all(promises);
56+
}

src/catalog-entry.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as events from './events';
2-
31
import { applyStyle, boxShadow, prepareTemplate } from './styles';
42

53
const templateHTML = `
@@ -38,30 +36,15 @@ const templateHTML = `
3836
padding-left: 5px;
3937
}
4038
41-
#org {
42-
padding-left: 15px;
43-
font-size: 14px;
44-
line-height: 36px;
45-
cursor: pointer;
46-
transition: color ease-in 100ms;
47-
color: rgba(0,0,0,0.8);
48-
color: rgba(0,0,0,0.8);
49-
}
50-
51-
#org:hover{
52-
color: rgba(0,0,0,0.5);
53-
}
54-
5539
github-avatar{
5640
padding-left: 5px;
5741
}
5842
5943
</style>
6044
<div>
6145
<div class="header">
62-
<div id="repo"></div>
46+
<div id="name"></div>
6347
<div id="version"></div>
64-
<div id="org"></div>
6548
<github-avatar size="30"></github-avatar>
6649
</div>
6750
<c-tabs>
@@ -105,14 +88,10 @@ export default class CatalogEntry extends HTMLElement {
10588
}
10689
let e = this._element;
10790

108-
this.shadowRoot.querySelector('#repo').textContent = e.repo;
91+
this.shadowRoot.querySelector('#name').textContent = e.name;
10992
this.shadowRoot.querySelector('#version').textContent = e.tag;
110-
this.shadowRoot.querySelector('#org').textContent = e.org;
111-
this.shadowRoot.querySelector('github-avatar').setAttribute('user', e.org);
93+
this.shadowRoot.querySelector('github-avatar').setAttribute('user', e.name);
11294

113-
this.shadowRoot.querySelector('#org').addEventListener('click', (e) => {
114-
this.dispatchEvent(events.viewOrg(this._element));
115-
});
11695

11796
customElements.whenDefined('info-panel')
11897
.then(() => {

src/common.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/events.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11

2-
export const VIEW_ORG = 'view-org';
3-
export const VIEW_REPO = 'view-repo';
2+
export const ELEMENT_CLICK = 'on-element-click';
43

5-
export function viewRepo(element) {
6-
return new CustomEvent(VIEW_REPO, {
4+
export function elementClick(element) {
5+
return new CustomEvent(ELEMENT_CLICK, {
76
bubbles: true,
87
composed: true,
9-
detail: {
10-
element: element
11-
}
8+
detail: { element }
129
});
1310
}
1411

15-
export function viewOrg(element) {
16-
return new CustomEvent(VIEW_ORG, {
17-
bubbles: true,
18-
composed: true,
19-
detail: {
20-
element: element
21-
}
22-
});
23-
}

0 commit comments

Comments
 (0)