Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(searchbox): fix usage of custom reset template #2585

Merged
merged 7 commits into from
Nov 20, 2017

Conversation

bobylito
Copy link
Contributor

fix #2528. If we were to fix that completely we'd probably change the options to make them more consistent with the rest of the library and we'd fix the markup.

What this does:

  • adds two new css classes to help customize the reset and magnifying glass
  • fix the usage of the reset template (was just plain broken)

@algobot
Copy link
Contributor

algobot commented Nov 19, 2017

Deploy preview ready!

Built with commit dedbcb7

https://deploy-preview-2585--algolia-instantsearch.netlify.com

@Haroenv
Copy link
Contributor

Haroenv commented Nov 20, 2017

Doesn't seem like you changed any test, but I think it was testing the block / none styling: https://travis-ci.org/algolia/instantsearch.js/builds/304400146#L917-L935

@bobylito
Copy link
Contributor Author

Doesn't seem like you changed any test, but I think it was testing the block / none styling: https://travis-ci.org/algolia/instantsearch.js/builds/304400146#L917-L935

Oops fixing that :)

@@ -243,7 +245,7 @@ describe('searchBox()', () => {
simulateInputEvent('test', 'tes', widget, helper, state, container);

// When
$('button[type="reset"]')[0].click();
$('.ais-search-box--reset-wrapper')[0].click();
Copy link
Contributor

@Haroenv Haroenv Nov 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the button is still type reset right? Not sure from this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. The problem is that it is in the template, so we cannot rely on what's inside it for the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the source of the bug. If you were to use an emoji, there would not be a button (with type=reset) so instead the event listener is on the outer span.

@@ -10,6 +10,7 @@
"scripts": {
"build": "./scripts/build.sh",
"dev": "./scripts/dev.sh",
"dev-novel": "NODE_ENV=development webpack-dev-server --config dev/webpack.config.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably reuse this command from the dev.sh script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? This line was extracted from dev.sh.

Copy link
Contributor

@samouss samouss Nov 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean in the dev.sh we can do yarn dev-novel instead of having the same command in two different places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a big improvement though. Let's iterate on that later.

@bobylito bobylito merged commit aad92b9 into develop Nov 20, 2017
@bobylito bobylito deleted the fix/searchbox-templates branch November 20, 2017 13:51
bobylito pushed a commit that referenced this pull request Nov 20, 2017
<a name=2.2.5></a>
## [2.2.5](v2.2.4...v2.2.5) (2017-11-20)

### Bug Fixes

* **searchbox:** fix usage of custom reset template ([#2585](#2585)) ([aad92b9](aad92b9)), closes [#2528](#2528)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SearchBox Widget: Template options are janky/broken
4 participants