From 66955f92dda82e5b0045af5312f1e8f1bcd9c141 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Wed, 9 Feb 2022 16:18:27 +0100 Subject: [PATCH] By default, use new seed format Signed-off-by: Alexis Sellier --- src/SeedAddress.spec.ts | 5 ++--- src/SeedAddress.svelte | 14 +++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/SeedAddress.spec.ts b/src/SeedAddress.spec.ts index 2bc72a876..e91ae8620 100644 --- a/src/SeedAddress.spec.ts +++ b/src/SeedAddress.spec.ts @@ -13,8 +13,7 @@ describe('SeedAddress', function () { port: 8776 } }, styles); - cy.findByText("hydkkk…coygh1@seed.cloudhead.io").should("exist").should("have.attr", "href", "/seeds/seed.cloudhead.io"); - cy.findByText(":8776").should("exist"); + cy.findByText("seed.cloudhead.io").should("exist").should("have.attr", "href", "/seeds/seed.cloudhead.io"); cy.findByText("Copy").should("exist"); }); @@ -22,7 +21,7 @@ describe('SeedAddress', function () { cy.findByText("Copy").click().should("exist"); cy.findByText("Copy ✓").should("have.attr", "disabled"); // We invoke the cy.window here since doing the clipboard action in the runner window, would throw an error - cy.window().its("navigator.clipboard").invoke("readText").should("equal", "hydkkkf5ksbe5fuszdhpqhytu3q36gwagj874wxwpo5a8ti8coygh1@seed.cloudhead.io:8776"); + cy.window().its("navigator.clipboard").invoke("readText").should("equal", "seed.cloudhead.io"); cy.wait(4000); cy.findByText("Copy").click().should("exist").should("not.have.attr", "disabled"); }); diff --git a/src/SeedAddress.svelte b/src/SeedAddress.svelte index e475eac59..b2a574665 100644 --- a/src/SeedAddress.svelte +++ b/src/SeedAddress.svelte @@ -4,11 +4,15 @@ export let seed: Seed; export let port: number; + export let full = false; let seedCopied = false; const copySeed = (seedId: string, seedHost: string) => { - return () => toClipboard(formatSeedAddress(seedId, seedHost, port)).then(() => { + const str = full + ? formatSeedAddress(seedId, seedHost, port) + : seedHost; + return () => toClipboard(str).then(() => { seedCopied = true; setTimeout(() => { seedCopied = false; @@ -38,8 +42,12 @@
🌱 - {formatSeedId(seed.id)}@{seed.host} - :{port} + {#if full} + {formatSeedId(seed.id)}@{seed.host} + :{port} + {:else} + {seed.host} + {/if}