Skip to content

Commit

Permalink
Add hyperlink on the bottom (#4664)
Browse files Browse the repository at this point in the history
* Add hyperlink to webstatus.dev

* Address comments

* Add a unit test
  • Loading branch information
KyleJu authored Jan 8, 2025
1 parent e5a0b02 commit 70a1c9d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client-src/css/forms-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const FORM_STYLES = [
.fade-in {
animation:fadeIn 0.5s linear;
}
@keyframes fadeIn {
0% {
opacity:0
Expand Down Expand Up @@ -234,7 +234,7 @@ export const FORM_STYLES = [
chromedash-form-field td.extrahelp {
padding-left: 2em;
}
chromedash-form-field .extrahelp > span {
chromedash-form-field .extrahelp > span, chromedash-form-field .webdx > span {
margin: 0;
}
Expand Down
16 changes: 16 additions & 0 deletions client-src/elements/chromedash-form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,22 @@ export class ChromedashFormField extends LitElement {
</tr>
`
: nothing}
${this.name === 'web_feature' && this.value
? html`
<tr>
<td colspan="2" class="webdx">
See web feature
<a
href="https://webstatus.dev/features/${this.value}"
target="_blank"
>
${this.value}
</a>
in webstatus.dev
</td>
</tr>
`
: nothing}
`;
}
}
Expand Down
16 changes: 16 additions & 0 deletions client-src/elements/chromedash-form-field_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ describe('chromedash-form-field', () => {
assert.include(renderElement.innerHTML, 'class="extrahelp"');
});

it('renders feature group field with a link', async () => {
const component = await fixture(
html` <chromedash-form-field name="web_feature" value="hwb">
</chromedash-form-field>`
);
assert.exists(component);
assert.instanceOf(component, ChromedashFormField);
const fieldRow = component.renderRoot.querySelector('tr');
assert.exists(fieldRow);

const renderElement = component.renderRoot as HTMLElement;
assert.include(renderElement.innerHTML, 'Feature Group');
assert.include(renderElement.innerHTML, 'input');
assert.include(renderElement.innerHTML, 'class="webdx"');
});

it('renders a textarea type of field', async () => {
const component = await fixture(
html` <chromedash-form-field name="summary" value="">
Expand Down
3 changes: 3 additions & 0 deletions packages/playwright/tests/test_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ export async function enterFeatureGroup(page) {
const featureGroupInput = featureGroupInputWrapper.locator('input');
await featureGroupInput.fill('hwb');
await delay(500);

// TODO(kyleju): assert that the link to webstatus.dev is present.
// It is missing in the current test setup.
}

/**
Expand Down

0 comments on commit 70a1c9d

Please sign in to comment.