Skip to content

Commit

Permalink
[W-15595110] server list template (#47)
Browse files Browse the repository at this point in the history
* space when no description in server added

* 4.6.8

* test fixed
  • Loading branch information
NazaQuintero authored May 6, 2024
1 parent 0bf363d commit fc74a78
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/ApiSummary.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable lit-a11y/click-events-have-key-events */
/* eslint-disable no-param-reassign */
/* eslint-disable class-methods-use-this */
import { LitElement, html } from 'lit-element';
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
import { AmfHelperMixin } from '@api-components/amf-helper-mixin';
import markdownStyles from '@advanced-rest-client/markdown-styles/markdown-styles.js';
import labelStyles from '@api-components/http-method-label/http-method-label-common-styles.js';
import sanitizer from 'dompurify';
import '@advanced-rest-client/arc-marked/arc-marked.js';
import '@api-components/api-method-documentation/api-url.js';
import styles from './Styles.js';
import { LitElement, html } from "lit-element";
import { unsafeHTML } from "lit-html/directives/unsafe-html.js";
import { AmfHelperMixin } from "@api-components/amf-helper-mixin";
import markdownStyles from "@advanced-rest-client/markdown-styles/markdown-styles.js";
import labelStyles from "@api-components/http-method-label/http-method-label-common-styles.js";
import sanitizer from "dompurify";
import "@advanced-rest-client/arc-marked/arc-marked.js";
import "@api-components/api-method-documentation/api-url.js";
import styles from "./Styles.js";

/** @typedef {import('lit-element').TemplateResult} TemplateResult */

Expand Down Expand Up @@ -424,7 +424,7 @@ export class ApiSummary extends AmfHelperMixin(LitElement) {
const serverNameTemplate = this._serverNameTemplate(server);
const serverTagsTemplate = this._serverTagsTemplate(server);
const listItemClass = description ? "" : "without-description";
return html`<li class=${listItemClass}>
return html`<li class="server-item ${listItemClass}">
${serverNameTemplate} ${uri} ${serverTagsTemplate}
<arc-marked
.markdown=${description}
Expand Down Expand Up @@ -468,7 +468,7 @@ export class ApiSummary extends AmfHelperMixin(LitElement) {
this._getAmfKey(this.ns.aml.vocabularies.core.name)
);

return html`<span class="server-name">${serverName}</span>`
return html`<span class="server-name">${serverName}</span>`;
}

/**
Expand Down
7 changes: 5 additions & 2 deletions test/api-summary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,11 @@ describe('ApiSummary', () => {
element = await modelFixture(asyncAmf);
});

it('should render server uri for API', () => {
assert.equal(element.shadowRoot.querySelector('api-url').url, 'amqp://broker.mycompany.com');
it("should render server uri for API", () => {
assert.equal(
element.shadowRoot.querySelector(".server-name").textContent,
"production"
);
});

it('should render "API channels" message', () => {
Expand Down

0 comments on commit fc74a78

Please sign in to comment.