gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 04/06: terms of service stories into its own scenari


From: gnunet
Subject: [taler-wallet-core] 04/06: terms of service stories into its own scenarios (removed from withdraw)
Date: Mon, 11 Apr 2022 16:36:52 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

commit 2bf8976d887061276df49c105c0527f28b127966
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Mon Apr 11 11:34:36 2022 -0300

    terms of service stories into its own scenarios (removed from withdraw)
---
 .../src/cta/TermsOfServiceSection.stories.tsx      | 179 +++++++++++++++++++++
 .../src/cta/TermsOfServiceSection.tsx              |   2 +-
 2 files changed, 180 insertions(+), 1 deletion(-)

diff --git 
a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx 
b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx
new file mode 100644
index 00000000..f24da1e1
--- /dev/null
+++ 
b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.stories.tsx
@@ -0,0 +1,179 @@
+/*
+ This file is part of GNU Taler
+ (C) 2021 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ *
+ * @author Sebastian Javier Marchano (sebasjm)
+ */
+
+import { createExample } from "../test-utils.js";
+import { termsHtml, termsPdf, termsPlain, termsXml } from "./termsExample.js";
+import { TermsOfServiceSection as TestedComponent } from 
"./TermsOfServiceSection.js";
+
+function parseFromString(s: string): Document {
+  if (typeof window === "undefined") {
+    return {} as Document;
+  }
+  return new window.DOMParser().parseFromString(s, "text/xml");
+}
+
+export default {
+  title: "cta/terms of service",
+  component: TestedComponent,
+};
+
+export const ReviewingPLAIN = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "plain",
+      content: termsPlain,
+    },
+    status: "new",
+    version: "",
+  },
+  reviewing: true,
+});
+
+export const ReviewingHTML = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "html",
+      href: new URL(`data:text/html;base64,${toBase64(termsHtml)}`),
+    },
+    version: "",
+    status: "new",
+  },
+  reviewing: true,
+});
+
+function toBase64(str: string): string {
+  return btoa(
+    encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
+      return String.fromCharCode(parseInt(p1, 16));
+    }),
+  );
+}
+
+export const ReviewingPDF = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "pdf",
+      location: new URL(`data:text/html;base64,${toBase64(termsPdf)}`),
+    },
+    status: "new",
+    version: "",
+  },
+  reviewing: true,
+});
+
+export const ReviewingXML = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    status: "new",
+    version: "",
+  },
+  reviewing: true,
+});
+
+export const NewAccepted = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    status: "new",
+    version: "",
+  },
+  reviewed: true,
+});
+
+export const ShowAgainXML = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    version: "",
+    status: "new",
+  },
+  reviewed: true,
+  reviewing: true,
+});
+
+export const ChangedButNotReviewable = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    version: "",
+    status: "changed",
+  },
+});
+
+export const ChangedAndAllowReview = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    version: "",
+    status: "changed",
+  },
+  onReview: () => null,
+});
+
+export const NewButNotReviewable = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    version: "",
+    status: "new",
+  },
+});
+
+export const NewAndAllowReview = createExample(TestedComponent, {
+  terms: {
+    content: {
+      type: "xml",
+      document: parseFromString(termsXml),
+    },
+    version: "",
+    status: "new",
+  },
+  onReview: () => null,
+});
+
+export const NotFound = createExample(TestedComponent, {
+  terms: {
+    content: undefined,
+    status: "notfound",
+    version: "",
+  },
+});
+
+export const AlreadyAccepted = createExample(TestedComponent, {
+  terms: {
+    status: "accepted",
+    content: undefined,
+    version: "",
+  },
+});
diff --git 
a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx 
b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
index b4962768..05714486 100644
--- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
+++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
@@ -12,7 +12,7 @@ import {
 import { useTranslationContext } from "../context/translation.js";
 import { TermsState } from "../utils/index.js";
 
-interface Props {
+export interface Props {
   reviewing: boolean;
   reviewed: boolean;
   terms: TermsState;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]