afform_mock - Tweak example names/text
authorTim Otten <totten@civicrm.org>
Tue, 15 Oct 2019 14:35:23 +0000 (07:35 -0700)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:19 +0000 (19:13 -0700)
ext/afform/mock/ang/afExamplePage.aff.html [deleted file]
ext/afform/mock/ang/afExamplePage.aff.json [deleted file]
ext/afform/mock/ang/afex.aff.json
ext/afform/mock/ang/mockBareFile.aff.html [moved from ext/afform/mock/ang/fakelibBareFile.aff.html with 100% similarity]
ext/afform/mock/ang/mockFoo.aff.html [moved from ext/afform/mock/ang/fakelibFoo.aff.html with 100% similarity]
ext/afform/mock/ang/mockFoo.aff.json [moved from ext/afform/mock/ang/fakelibFoo.aff.json with 100% similarity]
ext/afform/mock/ang/mockPage.aff.html [new file with mode: 0644]
ext/afform/mock/ang/mockPage.aff.json [new file with mode: 0644]
ext/afform/mock/ang/testAfform.aff.html
ext/afform/mock/tests/phpunit/api/v4/AfformTest.php

diff --git a/ext/afform/mock/ang/afExamplePage.aff.html b/ext/afform/mock/ang/afExamplePage.aff.html
deleted file mode 100644 (file)
index 801da89..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<div>Hello {{routeParams.name}}.</div>
-<div>The foo says "<span fakelib-foo/>".</div>
-<div>The bare file says "<span fakelib-bare-file/>"</div>
diff --git a/ext/afform/mock/ang/afExamplePage.aff.json b/ext/afform/mock/ang/afExamplePage.aff.json
deleted file mode 100644 (file)
index 5aad8af..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"server_route": "civicrm/example-page", "requires":["fakelibFoo", "fakelibBareFile"]}
index a68f14a381535bf3fff9c3fe977ea54e63b7f741..7cb07054e8ab7731ccb7ee300e21aab07bc30d00 100644 (file)
@@ -1,4 +1,4 @@
 {
   "server_route": "civicrm/afex",
-  "requires":["fakelibFoo", "fakelibBareFile", "af", "afBlock", "afField"]
+  "requires":["mockFoo", "mockBareFile", "af", "afBlock", "afField"]
 }
diff --git a/ext/afform/mock/ang/mockPage.aff.html b/ext/afform/mock/ang/mockPage.aff.html
new file mode 100644 (file)
index 0000000..d3300ca
--- /dev/null
@@ -0,0 +1,3 @@
+<div>Hello {{routeParams.name}}.</div>
+<div>The foo says "<span mock-foo/>".</div>
+<div>The bare file says "<span mock-bare-file/>"</div>
diff --git a/ext/afform/mock/ang/mockPage.aff.json b/ext/afform/mock/ang/mockPage.aff.json
new file mode 100644 (file)
index 0000000..bd3a6ba
--- /dev/null
@@ -0,0 +1 @@
+{"server_route": "civicrm/mock-page", "requires":["mockFoo", "mockBareFile"]}
index ec38eb18055c89b563b2afcad0f8590b9ab73497..a8fecdb4f32227a1a0d64d0b24000167c2ecb65b 100644 (file)
@@ -2,21 +2,25 @@
   <div crm-ui-debug="modelListCtrl.getEntity('parent')" />
   <div crm-ui-debug="modelListCtrl.getData('parent')" />
   <af-entity type="Contact" data="{contact_type: 'Individual'}" name="parent" label="Parent" url-autofill="1" autofill="user" />
-  <af-entity type="Contact" name="spouse" label="Spouse" url-autofill="1" />
+  <af-entity type="Contact" data="{contact_type: 'Individual'}" name="spouse" label="Spouse" contact-relationship="['Spouse of', 'parent']" />
 
   <af-fieldset model="parent">
-    <af-field name="first_name" defn='{title: ts("Your First Name")}' />
+    <h3>About You</h3>
+
+    <af-field name="first_name" />
     <af-field name="last_name" />
-    <af-field name="contact_sub_type" defn="{widget: hidden}" value="Student" />
     <af-field name="gender_id" />
     <af-field name="constituent_information.Marital_Status" />
     <af-field name="constituent_information.Marriage_Date" />
     <af-field name="constituent_information.Most_Important_Issue" />
   </af-fieldset>
 
-  <af-fieldset model="spouse">
+  <af-fieldset model="spouse" ng-if="modelListCtrl.getData('parent')['constituent_information.Marital_Status'] == 'M'">
+    <h3>About Your Spouse</h3>
+
     <af-field name="first_name" defn='{title: ts("Spouse First Name")}' />
-    <af-field name="last_name" />
+    <af-field name="last_name" defn='{title: ts("Spouse Last Name")}' />
+    <af-field name="do_not_email" />
   </af-fieldset>
 
   <!-- General elements: FIELDSET, UL, BUTTON, P, H1 should work anywhere -->
index 097b2a7759682b1fe22e4b2eae96b87acd815039..2bbc3e106cd0b5fcb347e80f2f01884e9a38b531 100644 (file)
@@ -9,9 +9,9 @@ class api_v4_AfformTest extends api_v4_AfformTestCase {
 
   public function getBasicDirectives() {
     return [
-      ['afExamplePage', ['title' => '', 'description' => '', 'server_route' => 'civicrm/example-page']],
-      ['fakelibBareFile', ['title' => '', 'description' => '']],
-      ['fakelibFoo', ['title' => '', 'description' => '']],
+      ['mockPage', ['title' => '', 'description' => '', 'server_route' => 'civicrm/mock-page']],
+      ['mockBareFile', ['title' => '', 'description' => '']],
+      ['mockFoo', ['title' => '', 'description' => '']],
     ];
   }
 
@@ -69,7 +69,7 @@ class api_v4_AfformTest extends api_v4_AfformTestCase {
       $formats = ['html', 'shallow', 'deep'];
       foreach ($formats as $updateFormat) {
         foreach ($formats as $readFormat) {
-          $es[] = ['fakelibBareFile', $updateFormat, $example[$updateFormat], $readFormat, $example[$readFormat], $exampleFile];
+          $es[] = ['mockBareFile', $updateFormat, $example[$updateFormat], $readFormat, $example[$readFormat], $exampleFile];
         }
       }
     }