-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #406 from Klimatbyran/staging
Improved drop-down search, add docker build, improved UI, fixed typos and cleanup
- Loading branch information
Showing
11 changed files
with
163 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.git | ||
*Dockerfile* | ||
*docker-compose* | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:21-alpine3.18 | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY . ./ | ||
|
||
EXPOSE 3000 | ||
|
||
ENTRYPOINT [ "npm" ] | ||
|
||
CMD [ "run", "dev" ] |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { test } from 'vitest' | ||
import { getSortedMunicipalities, search } from '../../components/DropDown' | ||
|
||
test('Municipalities should be sorted by Swedish alphabetical order', () => { | ||
expect( | ||
getSortedMunicipalities(['Örebro', 'Säffle', 'Älmhult', 'Åre', 'Karlshamn']), | ||
).toEqual(['Karlshamn', 'Säffle', 'Åre', 'Älmhult', 'Örebro']) | ||
}) | ||
|
||
describe('When searching a list of sorted municipalities', () => { | ||
const municipalities = ['Göteborg', 'Malmö', 'Stockholm', 'Södertälje'] | ||
|
||
test('Results that do not include the query should be filtered out', () => { | ||
expect(search('holm', municipalities)).toEqual(['Stockholm']) | ||
expect(search('s', municipalities)).toEqual(['Stockholm', 'Södertälje']) | ||
}) | ||
|
||
test('The search is case-insensitive', () => { | ||
expect(search('göt', municipalities)).toEqual(['Göteborg']) | ||
expect(search('GÖt', municipalities)).toEqual(['Göteborg']) | ||
}) | ||
|
||
test('Results that start with the query should be prioritized', () => { | ||
expect(search('st', ['Avesta', 'Mariestad', 'Stockholm'])).toEqual([ | ||
'Stockholm', | ||
'Avesta', | ||
'Mariestad', | ||
]) | ||
}) | ||
}) |
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
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
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
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