Skip to content

Commit 70a1c9d

Browse files
authored
Add hyperlink on the bottom (#4664)
* Add hyperlink to webstatus.dev * Address comments * Add a unit test
1 parent e5a0b02 commit 70a1c9d

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

client-src/css/forms-css.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const FORM_STYLES = [
8181
.fade-in {
8282
animation:fadeIn 0.5s linear;
8383
}
84-
84+
8585
@keyframes fadeIn {
8686
0% {
8787
opacity:0
@@ -234,7 +234,7 @@ export const FORM_STYLES = [
234234
chromedash-form-field td.extrahelp {
235235
padding-left: 2em;
236236
}
237-
chromedash-form-field .extrahelp > span {
237+
chromedash-form-field .extrahelp > span, chromedash-form-field .webdx > span {
238238
margin: 0;
239239
}
240240

client-src/elements/chromedash-form-field.ts

+16
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,22 @@ export class ChromedashFormField extends LitElement {
466466
</tr>
467467
`
468468
: nothing}
469+
${this.name === 'web_feature' && this.value
470+
? html`
471+
<tr>
472+
<td colspan="2" class="webdx">
473+
See web feature
474+
<a
475+
href="https://webstatus.dev/features/${this.value}"
476+
target="_blank"
477+
>
478+
${this.value}
479+
</a>
480+
in webstatus.dev
481+
</td>
482+
</tr>
483+
`
484+
: nothing}
469485
`;
470486
}
471487
}

client-src/elements/chromedash-form-field_test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ describe('chromedash-form-field', () => {
6565
assert.include(renderElement.innerHTML, 'class="extrahelp"');
6666
});
6767

68+
it('renders feature group field with a link', async () => {
69+
const component = await fixture(
70+
html` <chromedash-form-field name="web_feature" value="hwb">
71+
</chromedash-form-field>`
72+
);
73+
assert.exists(component);
74+
assert.instanceOf(component, ChromedashFormField);
75+
const fieldRow = component.renderRoot.querySelector('tr');
76+
assert.exists(fieldRow);
77+
78+
const renderElement = component.renderRoot as HTMLElement;
79+
assert.include(renderElement.innerHTML, 'Feature Group');
80+
assert.include(renderElement.innerHTML, 'input');
81+
assert.include(renderElement.innerHTML, 'class="webdx"');
82+
});
83+
6884
it('renders a textarea type of field', async () => {
6985
const component = await fixture(
7086
html` <chromedash-form-field name="summary" value="">

packages/playwright/tests/test_utils.js

+3
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ export async function enterFeatureGroup(page) {
326326
const featureGroupInput = featureGroupInputWrapper.locator('input');
327327
await featureGroupInput.fill('hwb');
328328
await delay(500);
329+
330+
// TODO(kyleju): assert that the link to webstatus.dev is present.
331+
// It is missing in the current test setup.
329332
}
330333

331334
/**

0 commit comments

Comments
 (0)