Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34
FOUR-18303 | Write Tests for Screen Templates Section#1697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
4417d8261537ea46827c9eb2f7b5ee0babdc8b1a14File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -52,6 +52,7 @@ | ||
| <screen-toolbar | ||
| @undo="$refs.builder.undo()" | ||
| @redo="$refs.builder.redo()" | ||
| @open-templates="openTemplatesPanel" | ||
| @open-calc="openComputedProperties" | ||
| @open-customCss="openCustomCSS" | ||
| @open-watchers="openWatchersPopup" | ||
| @@ -111,6 +112,8 @@ | ||
| :screen="screen" | ||
| title="Default" | ||
| :render-controls="displayBuilder" | ||
| :show-templates-panel="showTemplatesPanel" | ||
| :reshow-templates-panel="reshowTemplatesPanel" | ||
| @change="updateConfig" | ||
| > | ||
| <default-loading-spinner /> | ||
| @@ -443,7 +446,11 @@ export default { | ||
| minimap: { | ||
| enabled: false | ||
| } | ||
| } | ||
| }, | ||
| showTemplatesPanel: false, | ||
| reshowTemplatesPanel: false, | ||
| myTemplatesData: null, | ||
| sharedTemplatesData: null, | ||
| }; | ||
| }, | ||
| computed: { | ||
| @@ -696,6 +703,12 @@ export default { | ||
| openWatchersPopup() { | ||
| this.$refs.watchersPopup.show(); | ||
| }, | ||
| openTemplatesPanel() { | ||
| this.showTemplatesPanel = true; | ||
| this.reshowTemplatesPanel = true; | ||
| this.$emit('update-templates-panel', this.showTemplatesPanel); | ||
sanjacornelius marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| window.ProcessMaker.EventBus.$emit("open-templates-panel"); | ||
| }, | ||
| openComputedProperties() { | ||
| this.$refs.computedProperties.show(); | ||
| }, | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,32 @@ | ||
| <template> | ||
| <div> | ||
| <div data-cy="screen-templates-section"> | ||
| <div class="d-flex justify-content-between"> | ||
| <h6 class="pt-2">Select a Template</h6> | ||
sanjacornelius marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| <button class="panel-close-btn" @click="$emit('close-templates-panel')"><i class="fas fa-times"></i></button> | ||
| <button | ||
| class="panel-close-btn" | ||
| @click="$emit('close-templates-panel')" | ||
| data-cy="close-templates-section" | ||
| > | ||
| <i class="fas fa-times"></i> | ||
| </button> | ||
| </div> | ||
| <div class="d-flex m-2 template-tabs justify-content-center"> | ||
| <b-button @click="showMyTemplates" class="d-inline default-template-btn px-1" :class="{ 'my-templates-selected': myTemplatesSelected }">My Templates</b-button> | ||
| <b-button @click="showSharedTemplates" class="d-inline default-template-btn" :class="{ 'shared-templates-selected': sharedTemplatesSelected }">Shared Templates</b-button> | ||
| <b-button | ||
| @click="showMyTemplates" | ||
| class="d-inline default-template-btn px-1" | ||
| :class="{ 'my-templates-selected': myTemplatesSelected }" | ||
| data-cy="my-templates-tab" | ||
| > | ||
| My Templates | ||
sanjacornelius marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| </b-button> | ||
| <b-button | ||
| @click="showSharedTemplates" | ||
| class="d-inline default-template-btn" | ||
| :class="{ 'shared-templates-selected': sharedTemplatesSelected }" | ||
| data-cy="shared-templates-tab" | ||
| > | ||
| Shared Templates | ||
sanjacornelius marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| </b-button> | ||
| </div> | ||
| <div class="d-flex justify-content-center"> | ||
| <div v-if="myTemplatesSelected" class="d-flex justify-content-center p-0"> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -296,14 +296,15 @@ | ||
| no-body | ||
| class="p-0 h-100 border-top-0 border-bottom-0 border-right-0 rounded-0" | ||
| > | ||
| <div v-if="myTemplatesData && showTemplatesPanel"> | ||
| <!--ADD NO TEMPLATES TO SHOW OPTION AND LOADING OPTION--> | ||
| <div v-if="showTemplatesPanel & !hideTemplatesPanel"> | ||
| <!--{{ templatesPanelComp }}--> | ||
| <b-card-body class="p-2 h-100 overflow-auto"> | ||
| <screen-templates | ||
| ref="screenTemplates" | ||
| v-model="templates" | ||
| :my-templates-data="myTemplatesData" | ||
| :shared-templates-data="sharedTemplatesData" | ||
| @close-templates-panel="$emit('close-templates-panel')" | ||
| @close-templates-panel="closeTemplatesPanel" | ||
| @show-shared-templates="$emit('show-shared-templates')" | ||
| /> | ||
| </b-card-body> | ||
| @@ -657,9 +658,14 @@ export default { | ||
| collapse: {}, | ||
| groupOrder: {}, | ||
| searchProperties: ['name'], | ||
| hideTemplatesPanel: false, | ||
| }; | ||
| }, | ||
| computed: { | ||
| // templatesPanelComp() { | ||
sanjacornelius marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // console.log('SHOWTEMPLATESPANEL =', this.showTemplatesPanel); | ||
| // console.log('HIDETEMPLATESPANEL =', this.hideTemplatesPanel); | ||
| // }, | ||
| sortedPages() { | ||
| return [...this.config].sort((a, b) => a.order - b.order); | ||
| }, | ||
| @@ -1291,7 +1297,7 @@ export default { | ||
| }); | ||
| }, | ||
| inspect(element = {}) { | ||
| this.$emit('close-templates-panel'); | ||
| this.closeTemplatesPanel(); | ||
| this.inspection = element; | ||
| this.selected = element; | ||
| const defaultAccordion = this.accordions.find( | ||
| @@ -1425,7 +1431,10 @@ export default { | ||
| this.updateState(); | ||
| this.inspect(clone); | ||
| }, | ||
| closeTemplatesPanel() { | ||
| this.hideTemplatesPanel = true; | ||
| window.ProcessMaker.EventBus.$emit("close-templates-panel"); | ||
| }, | ||
| } | ||
| }; | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| describe('Screen Template Section', () => { | ||
| it('Opens the screen template panel when Templates button is clicked', () => { | ||
| cy.visit("/"); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "be.visible" | ||
| ); | ||
| }) | ||
| }); | ||
| it("Closes the screen template panel when X button is clicked", () => { | ||
| cy.visit("/"); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "be.visible" | ||
| ); | ||
| cy.get("[data-cy=close-templates-section]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "not.exist" | ||
| ); | ||
| }); | ||
| it("Displays My Templates when My Templates button is clicked", () => { | ||
| cy.visit("/"); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "be.visible" | ||
| ); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=my-templates-tab]").click(); | ||
| // CHECK REQUEST DATA FOR is_public = 0 | ||
| cy.intercept( | ||
| "POST", | ||
| "/api/1.0/scripts/execute/1", | ||
| JSON.stringify({ | ||
| output: [ | ||
| { | ||
| value: "Jobs", | ||
| content: "Steve Jobs" | ||
| }, | ||
| { | ||
| value: "Musk", | ||
| content: "Elon Musk" | ||
| } | ||
| ] | ||
| }) | ||
| ); | ||
| }); | ||
| it("Displays Shared Templates when Shared Templates button is clicked", () => { | ||
| cy.visit("/"); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "be.visible" | ||
| ); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=shared-templates-tab]").click(); | ||
| // CHECK REQUEST DATA FOR is_public = 1 | ||
| }); | ||
| it("Is hidden when an Inspector Panel should open", () => { | ||
| cy.visit("/"); | ||
| cy.get("[data-cy=screen-templates]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "be.visible" | ||
| ); | ||
| cy.setPreviewDataInput({ name: "" }); | ||
| cy.openAcordeon("collapse-1"); | ||
| cy.get("[data-cy=controls-FormInput]").drag("[data-cy=screen-drop-zone]", { | ||
| position: "bottom" | ||
| }); | ||
| cy.get("[data-cy=screen-element-container]").click(); | ||
| cy.get("[data-cy=screen-templates-section]").should( | ||
| "not.exist" | ||
| ); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.