Skip to content

Commit

Permalink
Merge pull request #1186 from jamiehumphries/1185-search-form
Browse files Browse the repository at this point in the history
Fixes #1185 - search now uses 'sitesearch' param instead of two 'q' params.
  • Loading branch information
tommy351 committed Apr 8, 2015
2 parents afc75b9 + 8812b61 commit 2ad148c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/helper/search_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function searchFormHelper(options){
return '<form action="//google.com/search" method="get" accept-charset="UTF-8" class="' + className + '">' +
'<input type="search" name="q" results="0" class="' + className + '-input"' + (text ? ' placeholder="' + text + '"' : '') + '>' +
(button ? '<button type="submit" class="' + className + '-submit">' + (typeof button === 'string' ? button : text) + '</button>' : '') +
'<input type="hidden" name="q" value="site:' + config.url + '">' +
'<input type="hidden" name="sitesearch" value="' + config.url + '">' +
'</form>';
}

Expand Down
10 changes: 5 additions & 5 deletions test/scripts/helpers/search_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ describe('search_form', function(){
it('default', function(){
searchForm().should.eql('<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form">' +
'<input type="search" name="q" results="0" class="search-form-input" placeholder="Search">' +
'<input type="hidden" name="q" value="site:http://hexo.io">' +
'<input type="hidden" name="sitesearch" value="http://hexo.io">' +
'</form>');
});

it('class', function(){
searchForm({class: 'foo'}).should.eql('<form action="//google.com/search" method="get" accept-charset="UTF-8" class="foo">' +
'<input type="search" name="q" results="0" class="foo-input" placeholder="Search">' +
'<input type="hidden" name="q" value="site:http://hexo.io">' +
'<input type="hidden" name="sitesearch" value="http://hexo.io">' +
'</form>');
});

it('text', function(){
searchForm({text: 'Find'}).should.eql('<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form">' +
'<input type="search" name="q" results="0" class="search-form-input" placeholder="Find">' +
'<input type="hidden" name="q" value="site:http://hexo.io">' +
'<input type="hidden" name="sitesearch" value="http://hexo.io">' +
'</form>');
});

it('button enabled', function(){
searchForm({button: true, text: 'Find'}).should.eql('<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form">' +
'<input type="search" name="q" results="0" class="search-form-input" placeholder="Find">' +
'<button type="submit" class="search-form-submit">Find</button>' +
'<input type="hidden" name="q" value="site:http://hexo.io">' +
'<input type="hidden" name="sitesearch" value="http://hexo.io">' +
'</form>');
});

it('button text', function(){
searchForm({button: 'Go', text: 'Find'}).should.eql('<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form">' +
'<input type="search" name="q" results="0" class="search-form-input" placeholder="Find">' +
'<button type="submit" class="search-form-submit">Go</button>' +
'<input type="hidden" name="q" value="site:http://hexo.io">' +
'<input type="hidden" name="sitesearch" value="http://hexo.io">' +
'</form>');
});
});

0 comments on commit 2ad148c

Please sign in to comment.