This commit is contained in:
2020-04-05 14:36:46 +00:00
parent be813ef4fb
commit 0a315b4d57
2 changed files with 21 additions and 4 deletions

View File

@@ -83,11 +83,17 @@ export default {
//clear any local errors //clear any local errors
vm.clearErrors(); vm.clearErrors();
//if the search entry is in the results list then it's a drop down selection not a typed search so bail //if the search entry is in the results list then it's a drop down selection not a typed search so bail
console.log(
"watch searchentry checking if search or selection for entry:",
val
);
for (let i = 0; i < vm.searchResults.length; i++) { for (let i = 0; i < vm.searchResults.length; i++) {
if (vm.searchResults[i].name == val) { if (vm.searchResults[i].name == val) {
console.log("Yes, match, bail no search");
return; return;
} }
} }
console.log("past entry check, maybe search?");
if (!val || vm.fetching || !vm.initialized) { if (!val || vm.fetching || !vm.initialized) {
if (!vm.initialized) { if (!vm.initialized) {
vm.$nextTick(() => { vm.$nextTick(() => {
@@ -96,7 +102,8 @@ export default {
} }
return; return;
} }
//console.log("watch::searchentry - calling do search:"); console.log("watch::searchentry - calling do search on :", val);
this.doSearch(); this.doSearch();
}, },
errors(val) { errors(val) {
@@ -267,6 +274,7 @@ export default {
//NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly //NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly
//https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed //https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
//----------------- //-----------------
console.log("doSearch top, search for:", vm.searchEntry);
let vm = this; let vm = this;
let isATwoTermQuery = false; let isATwoTermQuery = false;
let queryTerms = []; let queryTerms = [];
@@ -282,6 +290,7 @@ export default {
if (val.includes(" ")) { if (val.includes(" ")) {
queryTerms = val.split(" "); queryTerms = val.split(" ");
if (queryTerms.length > 2) { if (queryTerms.length > 2) {
console.log("Query invalid 1");
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid")); vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
return; return;
} }
@@ -317,6 +326,7 @@ export default {
window.$gz._.startsWith(queryTerms[0], "..") && window.$gz._.startsWith(queryTerms[0], "..") &&
window.$gz._.startsWith(queryTerms[1], "..") window.$gz._.startsWith(queryTerms[1], "..")
) { ) {
console.log("Query invalid 2");
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid")); vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
return; return;
} }
@@ -326,6 +336,7 @@ export default {
!window.$gz._.startsWith(queryTerms[0], "..") && !window.$gz._.startsWith(queryTerms[0], "..") &&
!window.$gz._.startsWith(queryTerms[1], "..") !window.$gz._.startsWith(queryTerms[1], "..")
) { ) {
console.log("Query invalid 3");
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid")); vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid"));
return; return;
} }

View File

@@ -21,13 +21,19 @@ describe("PICK LIST TEMPLATE", () => {
cy.get("[data-cy=SelectTemplate]").type("3{enter}", { force: true }); cy.get("[data-cy=SelectTemplate]").type("3{enter}", { force: true });
//hide tags field //hide tags field
cy.get("[data-cy=useremployeenumberInclude]").uncheck({ force: true }); cy.get("[data-cy=usertagsInclude]").uncheck({ force: true });
// cy.get(
// '[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
// ).click();
cy.get( cy.get(
'[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon' '[data-cy="adm-global-select-templates:save"] > .v-btn__content > .v-icon'
).click(); ).click({ force: true });
cy.visit("/widgets/0"); cy.visit("/widgets/0");
cy.url().should("include", "/widgets/0"); cy.url().should("include", "/widgets/0");
cy.get("[data-cy=userid] > .v-input").type("a ..zone"); //select a user with a zone set
cy.get("[data-cy=userid] > .v-input").type(
"..zone{downarrow}{downarrow}{enter}"
);
//tags is off so there shouldn't be any "zones" visible in there //tags is off so there shouldn't be any "zones" visible in there
//----------------- //-----------------
}); });