diff --git a/README.md b/README.md index 0c1f2e8..9a50864 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # goodmap-frontend -Frontend for [GoodMap](https://github.com/Problematy/goodmap). +Frontend for [GoodMap](https://github.com/Problematy/goodmap) # Installing diff --git a/package.json b/package.json index a49ebbb..e6cd165 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@problematy/goodmap", - "version": "0.1.3", + "version": "0.1.4", "description": "Fronted scripts for map ", "main": "dist/map.js", "scripts": { diff --git a/tests/map.test.js b/tests/map.test.js index 5d6a70b..09b76a2 100644 --- a/tests/map.test.js +++ b/tests/map.test.js @@ -1,28 +1,57 @@ -import {createCheckboxWithType} from '../src/checkboxes.js' -import * as ReactDOMServer from 'react-dom/server'; +import {createFilterForm} from '../src/filter_form.js' -//TODO: this test should not need rendering to string -test("Creates good checkbox box", async () => { - expect( - ReactDOMServer.renderToStaticMarkup(createCheckboxWithType("gender", "female", "kobieta"))) - .toContain( - '
'); -}); +let categories = [ + [ + ["types", "typy" ], + [ + ["clothes", "ciuchy"], + ["shoes", "buty"] + ] + ] +] - -// -------------------------------- -import {getFormattedData} from '../src/formatters.js' -test("Formats data for popup well", async () => { - const fakeData = { - title: "test", - subtitle: "container", - data:{ - types: ["clothes"], - gender: ["men"], - condition: ["worn"] - } - }; - expect(getFormattedData(fakeData)).toBe( - '

test
container

types: clothes
gender: men
condition: worn

' - ); -}); +test("Creates good filter_form box", async () => { + expect(createFilterForm(categories, () => {})). +toMatchInlineSnapshot(` +
+
+ + typy + +
+ + +
+
+ + +
+
+
+`)});