diff --git a/.travis.yml b/.travis.yml index 382f4708d0..b26d0467c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ node_js: script: - yarn ci - - yarn danger + - yarn danger -- --verbose deploy: provider: script diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d1c5fc114..a596b767ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ #### Consignments -- Users now can access stories from inside the app - orta +- [dev] Adds component for attaching buttons to the keyboard - orta - [dev] Adds component for artist search - orta - [dev] Adds component for consignments todo - orta - [dev] Adds a root component for the Consignments flow - orta @@ -11,6 +11,7 @@ ### Emission +- Users now can access stories from inside the app - orta - [dev] Upgrades React Native to v0.45 - sarah - [dev] Allows toggling the back button by pressing space - orta diff --git a/src/lib/components/consignments/__stories__/index.tsx b/src/lib/components/consignments/__stories__/index.tsx index c86777f448..361553a1b4 100644 --- a/src/lib/components/consignments/__stories__/index.tsx +++ b/src/lib/components/consignments/__stories__/index.tsx @@ -10,7 +10,7 @@ import * as search from "./consignments-search.story" import * as todo from "./consignments-todo.story" // Just a quick interface so you know the API -interface AutoStory { +export interface AutoStory { name: string, allStates: any[], component: any diff --git a/src/lib/components/consignments/components/__tests__/__snapshots__/artist-search-results-tests.tsx.snap b/src/lib/components/consignments/components/__tests__/__snapshots__/artist-search-results-tests.tsx.snap index 5b0d2cbabb..7fb95654a9 100644 --- a/src/lib/components/consignments/components/__tests__/__snapshots__/artist-search-results-tests.tsx.snap +++ b/src/lib/components/consignments/components/__tests__/__snapshots__/artist-search-results-tests.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`For different states Looks right when Found four results 1`] = ` +exports[`Search states: Looks right when Found four results 1`] = ` - - - - - - DONE - - - - `; -exports[`For different states Looks right when Found no results 1`] = ` +exports[`Search states: Looks right when Found no results 1`] = ` - - - - - - DONE - - - - `; -exports[`For different states Looks right when Found one result 1`] = ` +exports[`Search states: Looks right when Found one result 1`] = ` - - - - - - DONE - - - - `; -exports[`For different states Looks right when Found one result, and searching 1`] = ` +exports[`Search states: Looks right when Found one result, and searching 1`] = ` - - - - - - DONE - - - - `; -exports[`For different states Looks right when Found two results 1`] = ` +exports[`Search states: Looks right when Found two results 1`] = ` - - - - - - DONE - - - - `; -exports[`For different states Looks right when Looking for new results 1`] = ` +exports[`Search states: Looks right when Looking for new results 1`] = ` - - - - - - DONE - - - - `; -exports[`For different states Looks right when No query 1`] = ` +exports[`Search states: Looks right when No query 1`] = ` - - - - - - DONE - - - - `; diff --git a/src/lib/components/consignments/components/__tests__/__snapshots__/artwork-consignment-todo-tests.tsx.snap b/src/lib/components/consignments/components/__tests__/__snapshots__/artwork-consignment-todo-tests.tsx.snap index 25be6f1657..248e0941e4 100644 --- a/src/lib/components/consignments/components/__tests__/__snapshots__/artwork-consignment-todo-tests.tsx.snap +++ b/src/lib/components/consignments/components/__tests__/__snapshots__/artwork-consignment-todo-tests.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`For different states Looks right withArtist 1`] = ` +exports[`TODO states: Looks right when Empty Metadata 1`] = ` + + + + ARTIST/DESIGNER + + + + + + + + + + + + PHOTOS + + + + + + + + + METADATA + + + + + + + + + + + + LOCATION + + + + + + + + + + + + PROVENANCE + + + + + + + +`; + +exports[`TODO states: Looks right when With Artist 1`] = ` + + + + + + + + ARTIST/DESIGNER + + + Glenn Brown + + + + + + + + + PHOTOS + + + + + + + + + METADATA + + + + + + + + + + + + LOCATION + + + + + + + + + + + + PROVENANCE + + + + + + + +`; + +exports[`TODO states: Looks right when With Just Metadata 1`] = ` + + + + + + + + ARTIST/DESIGNER + + + + + + + + + + + + PHOTOS + + + + + + + + + METADATA + + + 5/5 + + + + + + + + + LOCATION + + + + + + + + + + + + PROVENANCE + + + + + + + +`; + +exports[`TODO states: Looks right when With Location 1`] = ` + + + + + + + + ARTIST/DESIGNER + + + Glenn Brown + + + + + + + + + PHOTOS + + + + + 2 + + + + + + + + + + + METADATA + + + 5/5 + + + + + + + + + LOCATION + + + + + + + + + + + + PROVENANCE + + + + + + + +`; + +exports[`TODO states: Looks right when With Long 1`] = ` + + + + @@ -104,7 +1951,7 @@ exports[`For different states Looks right withArtist 1`] = ` ] } > - Glenn Brown + @@ -431,7 +2280,7 @@ exports[`For different states Looks right withArtist 1`] = ` ] } > - + This is a long long long run on sentence that should break correctly. `; -exports[`For different states Looks right withLocation 1`] = ` +exports[`TODO states: Looks right when With Metadata 1`] = ` @@ -852,7 +2699,7 @@ exports[`For different states Looks right withLocation 1`] = ` ] } > - Huddersfield, UK + `; -exports[`For different states Looks right withMetadata 1`] = ` +exports[`TODO states: Looks right when With One 1`] = ` - 2 + 1 @@ -1222,9 +3069,7 @@ exports[`For different states Looks right withMetadata 1`] = ` "marginRight": 20, "width": 26, }, - Object { - "backgroundColor": "white", - }, + undefined, ] } > @@ -1272,7 +3117,7 @@ exports[`For different states Looks right withMetadata 1`] = ` ] } > - 5/5 + `; -exports[`For different states Looks right withPhotos 1`] = ` +exports[`TODO states: Looks right when With Photos 1`] = ` `; -exports[`For different states Looks right withProvenance 1`] = ` +exports[`TODO states: Looks right when With Provenance 1`] = ` + + hi + + + + + + DONE + + + +`; + +exports[`Bottom-Aligned states: Looks right when With an Artist Search Results Component 1`] = ` + + + + + + + + + + + Unfortunately we are not accepting consignments for works by + + Banko + + + + + + + + + + DONE + + + +`; diff --git a/src/lib/components/consignments/components/__tests__/artist-search-results-tests.tsx b/src/lib/components/consignments/components/__tests__/artist-search-results-tests.tsx index 5dea00869f..96960cde0c 100644 --- a/src/lib/components/consignments/components/__tests__/artist-search-results-tests.tsx +++ b/src/lib/components/consignments/components/__tests__/artist-search-results-tests.tsx @@ -1,19 +1,4 @@ -import "react-native" +import * as Search from "../../__stories__/consignments-search.story" +import storyRunner from "./runner" -import * as React from "react" -import * as renderer from "react-test-renderer" - -import { allStates } from "../../__stories__/consignments-search.story" - -import Search from "../artist-search-results" - -describe("For different states", () => { - allStates.forEach(test => { - const name = Object.keys(test)[0] - const state = test[name] - it(`Looks right when ${name}`, () => { - const todo = renderer.create() - expect(todo.toJSON()).toMatchSnapshot() - }) - }) -}) +storyRunner("Search states: ", Search) diff --git a/src/lib/components/consignments/components/__tests__/artwork-consignment-todo-tests.tsx b/src/lib/components/consignments/components/__tests__/artwork-consignment-todo-tests.tsx index 2c6224e487..8c9244f3bd 100644 --- a/src/lib/components/consignments/components/__tests__/artwork-consignment-todo-tests.tsx +++ b/src/lib/components/consignments/components/__tests__/artwork-consignment-todo-tests.tsx @@ -1,20 +1,4 @@ -import "react-native" +import * as TODO from "../../__stories__/consignments-todo.story" +import storyRunner from "./runner" -import * as React from "react" -import * as renderer from "react-test-renderer" - -import { allStates } from "../../__stories__/consignments-todo.story" - -import TODO from "../artwork-consignment-todo" - -describe("For different states", () => { - for (const key in allStates) { - if (allStates.hasOwnProperty(key)) { - const state = allStates[key] - it(`Looks right ${key}`, () => { - const todo = renderer.create() - expect(todo.toJSON()).toMatchSnapshot() - }) - } - } -}) +storyRunner("TODO states:", TODO) diff --git a/src/lib/components/consignments/components/__tests__/bottom-aligned-button-tests.tsx b/src/lib/components/consignments/components/__tests__/bottom-aligned-button-tests.tsx new file mode 100644 index 0000000000..a4d2f6365c --- /dev/null +++ b/src/lib/components/consignments/components/__tests__/bottom-aligned-button-tests.tsx @@ -0,0 +1,4 @@ +import * as BottomAligned from "../../__stories__/consignments-bottom-aligned.story" +import storyRunner from "./runner" + +storyRunner("Bottom-Aligned states: ", BottomAligned) diff --git a/src/lib/components/consignments/components/__tests__/runner.tsx b/src/lib/components/consignments/components/__tests__/runner.tsx new file mode 100644 index 0000000000..3fa577f833 --- /dev/null +++ b/src/lib/components/consignments/components/__tests__/runner.tsx @@ -0,0 +1,23 @@ +import "react-native" + +import * as React from "react" +import * as renderer from "react-test-renderer" + +import { AutoStory } from "../../__stories__" + +const runTests = (title: string, storybook: AutoStory) => { + describe(title, () => { + storybook.allStates.forEach(test => { + const name = Object.keys(test)[0] + const state = test[name] + + it(`Looks right when ${name}`, () => { + const todo = renderer.create() + expect(todo.toJSON()).toMatchSnapshot() + }) + + }) + }) +} + +export default runTests diff --git a/src/lib/components/consignments/components/artist-search-results.tsx b/src/lib/components/consignments/components/artist-search-results.tsx index b355c77e46..572210c466 100644 --- a/src/lib/components/consignments/components/artist-search-results.tsx +++ b/src/lib/components/consignments/components/artist-search-results.tsx @@ -5,8 +5,6 @@ import styled from "styled-components/native" import colors from "../../../../data/colors" import fonts from "../../../../data/fonts" -import Button from "../../buttons/inverted_button" - const Input = styled.TextInput` height: 40 backgroundColor: black diff --git a/src/lib/components/consignments/components/bottom-aligned-button.tsx b/src/lib/components/consignments/components/bottom-aligned-button.tsx index f860122e88..99092550c3 100644 --- a/src/lib/components/consignments/components/bottom-aligned-button.tsx +++ b/src/lib/components/consignments/components/bottom-aligned-button.tsx @@ -14,7 +14,7 @@ const ButtonText = styled.Text` ` const Body = styled.TouchableOpacity` - height: 40 + height: 56 margin-bottom: 20 padding-top: 18 `