Skip to content

Commit

Permalink
NEW: Search Project Definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhieb committed Jun 7, 2024
1 parent 21351ee commit 7066d1b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions classes/help-text.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.help-text {
color: #AAA;
font-size: smaller;
padding: var(--text-padding-sm);
}
2 changes: 1 addition & 1 deletion data/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Database {
}

search(query) {
return this.components.filter(({ form }) => form.includes(query))
return this.components.filter(({ definition, form }) => form.includes(query) || definition.includes(query))
}

}
6 changes: 3 additions & 3 deletions pages/Search/Search.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

.results {

inline-size: max(max-content, 100%);
margin: 0;
margin-inline: auto;

Expand All @@ -52,8 +51,9 @@
}

search {
align-self: center;
margin: 1em;
align-self: center;
margin: 1em;
max-inline-size: 30em;
}

.search-controls {
Expand Down
2 changes: 1 addition & 1 deletion pages/Search/Search.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
>
<button class=button type=submit>Search</button>
</div>
<span class=help-text>Searches components (in any orthography) and definitions.</span>
<span class=help-text>Searches components (in any orthography) and definitions for exact matches anywhere within the string. Leave blank and press "Search" to display all components.</span>
</form>
</search>

Expand Down
7 changes: 6 additions & 1 deletion pages/Search/Search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ describe(`Search`, function() {

it(`Forms (Source)`)

it(`Definition (Project)`)
it.only(`Definition (Project)`, function() {
cy.visit(`/search`)
cy.get(`#search-box`).type(`think`)
cy.get(`form`).submit()
cy.get(`.results tbody tr`).should(`have.length`, 1)
})

it(`Definitions (Source)`)

Expand Down

0 comments on commit 7066d1b

Please sign in to comment.