-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CW-202 Update form selection in the Engage page This was to implement the new wireframe. * CW-202 Fix form required asterisk placement The asterisk is now added through :after CSS rather than as a <span>. * CW-202 Put arrow next to the SEND button This is in accordance with the wireframe. * CW-202 Update Cypress tests Since Cypress can't test the :after CSS decorator natively, I'm testing for the precense of the required class instead. I also changed the way forms a switched on Cypress and added all necessary data-cy attributes to tags.
- Loading branch information
1 parent
517a14c
commit cbed21f
Showing
3 changed files
with
35 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,26 +12,23 @@ | |
<v-col class="form-box" data-cy="mailing-form"> | ||
<v-form ref="form" v-model="valid"> | ||
<!-- Name --> | ||
<label class="text-body-1 input-label" :data-cy="`${this.type}-name-label`"> | ||
<label :class="getLabelClass(!isType('feedback'))" :data-cy="`${this.type}-name-label`"> | ||
{{ isType('sponsorship') ? "Company Name" : "Name" }} | ||
<span v-if="!isType('feedback')" class="required">*</span> | ||
</label> | ||
<v-text-field class="input" placeholder="John Smith" v-model="name" :data-cy="`${this.type}-name-field`" | ||
:rules="[ !isType('feedback') ? rules.required : true ]"></v-text-field> | ||
<!-- Email --> | ||
<label class="text-body-1 input-label" :data-cy="`${this.type}-email-label`"> Email | ||
<span v-if="!isType('feedback')" class="required">*</span> | ||
<label :class="getLabelClass(!isType('feedback'))" :data-cy="`${this.type}-email-label`"> Email | ||
</label> | ||
<v-text-field class="input" placeholder="[email protected]" v-model="email" :data-cy="`${this.type}-email-field`" | ||
:rules="[ rules.email, !isType('feedback') ? rules.required : true ]"></v-text-field> | ||
<!-- Message --> | ||
<label class="text-body-1 input-label" :data-cy="`${this.type}-message-label`"> Message | ||
<span class="required">*</span> | ||
<label :class="getLabelClass(true)" :data-cy="`${this.type}-message-label`"> Message | ||
</label> | ||
<v-textarea class="input" placeholder="Message" v-model="body" :data-cy="`${this.type}-message-field`" | ||
:rules="[ rules.required ]"></v-textarea> | ||
<!-- Send button --> | ||
<v-btn text style="margin-left:60%" :disabled="!valid" @click="send" :data-cy="`${this.type}-send-button`">Send</v-btn> | ||
<v-btn text style="margin-left:60%" :disabled="!valid" @click="send" :data-cy="`${this.type}-send-button`">Send ></v-btn> | ||
</v-form> | ||
</v-col> | ||
</v-row> | ||
|
@@ -60,6 +57,11 @@ export default { | |
isType(name) { | ||
return this.type === name; | ||
}, | ||
getLabelClass(isRequired) { | ||
const lc = 'text-body-1 input-label'; | ||
if (isRequired) return lc.concat(' required'); | ||
return lc; | ||
}, | ||
send() { | ||
APIClient.mailingAPI(MAILING_URL[this.type], this.name, this.email, this.body) | ||
.then((res) => { | ||
|
@@ -97,8 +99,8 @@ export default { | |
float:left; | ||
} | ||
|
||
.required | ||
{ | ||
.required:after { | ||
content:" *"; | ||
color: red; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters