From f1e5784de6a6d9a6fba3a1bd128100fed003312b Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Tue, 16 Jul 2019 14:35:33 +0200 Subject: [PATCH 1/2] feat(RefinementList): forward class names to input fixes #644 --- src/components/RefinementList.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/RefinementList.vue b/src/components/RefinementList.vue index f9ed8bc64..2de1224e1 100644 --- a/src/components/RefinementList.vue +++ b/src/components/RefinementList.vue @@ -25,6 +25,7 @@ Date: Tue, 16 Jul 2019 14:44:04 +0200 Subject: [PATCH 2/2] test: add test for this behaviour --- src/components/__tests__/RefinementList.js | 20 +++ .../__snapshots__/RefinementList.js.snap | 162 ++++++++++++++++++ 2 files changed, 182 insertions(+) diff --git a/src/components/__tests__/RefinementList.js b/src/components/__tests__/RefinementList.js index 58e650623..1622c66d7 100644 --- a/src/components/__tests__/RefinementList.js +++ b/src/components/__tests__/RefinementList.js @@ -103,6 +103,26 @@ it("allows override of placeholder when it's searchable", () => { ); }); +it("allows search bar classes override when it's searchable", () => { + __setState({ + ...defaultState, + }); + const wrapper = mount(RefinementList, { + propsData: { + searchable: true, + attribute: 'something', + classNames: { + 'ais-SearchBox-form': 'moar-classes', + }, + }, + }); + expect(wrapper.html()).toMatchSnapshot(); + + expect(wrapper.find('.ais-SearchBox-form').hasClass('moar-classes')).toBe( + true + ); +}); + it("disables show more if can't refine", () => { __setState({ ...defaultState, diff --git a/src/components/__tests__/__snapshots__/RefinementList.js.snap b/src/components/__tests__/__snapshots__/RefinementList.js.snap index c7771366d..6adff0248 100644 --- a/src/components/__tests__/__snapshots__/RefinementList.js.snap +++ b/src/components/__tests__/__snapshots__/RefinementList.js.snap @@ -1,5 +1,167 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`allows search bar classes override when it's searchable 1`] = ` + +
+ +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+ +`; + exports[`renders correctly (empty) 1`] = `