diff --git a/pages/Search/Search.hbs b/pages/Search/Search.hbs index 6e7db8df..1bfc3728 100644 --- a/pages/Search/Search.hbs +++ b/pages/Search/Search.hbs @@ -57,8 +57,8 @@
- - + +
@@ -138,6 +138,11 @@
+
+ + +
+
diff --git a/pages/Search/Search.test.js b/pages/Search/Search.test.js index a1c6ad15..4254a1c2 100644 --- a/pages/Search/Search.test.js +++ b/pages/Search/Search.test.js @@ -72,7 +72,7 @@ describe(`Search`, function() { it(`Option: Match Diacritics (checked)`, function() { cy.visit(`/search`) - cy.get(`#diacritics-box`).check() + cy.get(`#quick-diacritics-box`).check() cy.get(`#search-box`).type(`aštimw`) cy.get(`#quick-search-form`).submit() cy.get(`.num-results`).should(`include.text`, `of 2`) @@ -152,12 +152,12 @@ describe(`Search`, function() { it(`Settings`, function() { cy.visit(`/search`) cy.get(`#quick-case-sensitive-box`).check() - cy.get(`#diacritics-box`).check() + cy.get(`#quick-diacritics-box`).check() cy.get(`#regex-box`).check() cy.get(`#quick-language-select`).select(`Cree_East`) cy.reload() cy.get(`#quick-case-sensitive-box`).should(`be.checked`) - cy.get(`#diacritics-box`).should(`be.checked`) + cy.get(`#quick-diacritics-box`).should(`be.checked`) cy.get(`#regex-box`).should(`be.checked`) cy.get(`#quick-language-select`).should(`have.value`, `Cree_East`) }) @@ -207,14 +207,24 @@ describe(`Search`, function() { cy.get(`#advanced-case-sensitive-box`).should(`be.checked`) }) + it(`Option: Match Diacritics`, function() { + cy.visit(`/search`) + cy.contains(`label`, `Advanced Search`).click() + cy.get(`#advanced-diacritics-box`).check() + cy.get(`#form-box`).type(`aštimw`) + cy.get(`#advanced-search-form`).submit() + cy.get(`.num-results`).should(`include.text`, `of 2`) + }) + it(`Settings`, function() { cy.visit(`/search`) cy.contains(`label`, `Advanced Search`).click() cy.get(`#advanced-language-select`).select(`Cree_East`) cy.get(`#advanced-case-sensitive-box`).check() + cy.get(`#advanced-diacritics-box`).check() cy.reload() cy.get(`#advanced-language-select`).should(`have.value`, `Cree_East`) - cy.get(`#advanced-case-sensitive-box`).should(`be.checked`) + cy.get(`#advanced-diacritics-box`).should(`be.checked`) }) }) diff --git a/pages/Search/scripts/AdvancedSearch.js b/pages/Search/scripts/AdvancedSearch.js index 6ac4d1a0..010da949 100644 --- a/pages/Search/scripts/AdvancedSearch.js +++ b/pages/Search/scripts/AdvancedSearch.js @@ -7,6 +7,7 @@ export default class AdvancedSearch { */ constructor() { this.caseSensitive = document.getElementById(`advanced-case-sensitive-box`) + this.diacritics = document.getElementById(`advanced-diacritics-box`) this.language = document.getElementById(`advanced-language-select`) } @@ -15,6 +16,7 @@ export default class AdvancedSearch { */ listen() { this.caseSensitive.addEventListener(`input`, this.save.bind(this)) + this.diacritics.addEventListener(`input`, this.save.bind(this)) this.language.addEventListener(`input`, this.save.bind(this)) } @@ -27,6 +29,7 @@ export default class AdvancedSearch { // Restore search settings this.caseSensitive.checked = localStorage.getItem(`caseSensitive`) === `true` + this.diacritics.checked = localStorage.getItem(`diacritics`) === `true` this.language.value = localStorage.getItem(`language`) } @@ -36,6 +39,7 @@ export default class AdvancedSearch { */ save() { localStorage.setItem(`caseSensitive`, this.caseSensitive.checked) + localStorage.setItem(`diacritics`, this.diacritics.checked) localStorage.setItem(`language`, this.language.value) } diff --git a/pages/Search/scripts/QuickSearch.js b/pages/Search/scripts/QuickSearch.js index 492a2207..481c9129 100644 --- a/pages/Search/scripts/QuickSearch.js +++ b/pages/Search/scripts/QuickSearch.js @@ -7,7 +7,7 @@ export default class QuickSearch { */ constructor() { this.caseSensitive = document.getElementById(`quick-case-sensitive-box`) - this.diacritics = document.getElementById(`diacritics-box`) + this.diacritics = document.getElementById(`quick-diacritics-box`) this.form = document.getElementById(`quick-search-form`) this.language = document.getElementById(`quick-language-select`) this.regex = document.getElementById(`regex-box`)