Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/amo/components/Category/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { compose } from 'redux';

import CategoryHeader from 'amo/components/CategoryHeader';
import Search from 'amo/components/Search';
import { SearchBase } from 'amo/components/Search';
import { categoriesFetch } from 'core/actions/categories';
import { loadByCategoryIfNeeded, parsePage } from 'core/searchUtils';
import {
Expand Down Expand Up @@ -35,7 +35,7 @@ export class CategoryBase extends React.Component {
return (
<div className="Category">
<CategoryHeader category={category} />
<Search enableSearchSort={false} {...searchProps} />
<SearchBase enableSearchSort={false} hasSearchParams {...searchProps} />
</div>
);
}
Expand Down Expand Up @@ -65,7 +65,6 @@ export function mapStateToProps(state, ownProps) {
return {
addonType: filters.addonType,
category,
hasSearchParams: true,
filters,
pathname,
queryParams,
Expand All @@ -76,7 +75,6 @@ export function mapStateToProps(state, ownProps) {
return {
addonType: filters.addonType,
category,
hasSearchParams: true,
pathname,
queryParams,
};
Expand Down
15 changes: 11 additions & 4 deletions tests/unit/amo/components/TestCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { shallow } from 'enzyme';
import React from 'react';

import { CategoryBase, mapStateToProps } from 'amo/components/Category';
import Search from 'amo/components/Search';
import { SearchBase } from 'amo/components/Search';
import createStore from 'amo/store';
import { categoriesFetch } from 'core/actions/categories';
import { searchStart } from 'core/actions/search';
Expand Down Expand Up @@ -50,7 +50,16 @@ describe('Category', () => {

it('disables the sort component in Search', () => {
const root = render();
expect(root.find(Search)).toHaveProp('enableSearchSort', false);

expect(root.find(SearchBase)).toHaveProp('enableSearchSort', false);
});

it('forces hasSearchParams for the Search component', () => {
// This prevents search results not appearing because the search
// component doesn't recognise a valid search param.
const root = render();

expect(root.find(SearchBase)).toHaveProp('hasSearchParams', true);
});
});

Expand Down Expand Up @@ -84,7 +93,6 @@ describe('Category.mapStateToProps()', () => {
category: null,
count: 0,
filters,
hasSearchParams: true,
loading: true,
page: undefined,
pathname: '/themes/ad-block/',
Expand All @@ -103,7 +111,6 @@ describe('Category.mapStateToProps()', () => {
expect(props).toEqual({
addonType: ADDON_TYPE_THEME,
category: null,
hasSearchParams: true,
pathname: '/themes/ad-block/',
queryParams: { page: 1 },
});
Expand Down