Mailspring/internal_packages/thread-search/spec/search-bar-spec.cjsx
Juan Tejada d3dcf89e9f feat(event-search): Add event search to calendar
Summary:
This commit adds the ability to perform event search in the calendar window.
To achieve this, SearchBar has been moved from the thread-search package to be a part
of the nylas-component-kit, and reused by both thread-search and nylas-calendar

When an event is selected from search results, the calendar view is moved to the selected
event. Depends on D3396 to open the event popover.

Test Plan: Manual

Reviewers: halla, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D3424
2016-11-15 17:27:31 -08:00

26 lines
959 B
CoffeeScript

React = require 'react'
ReactDOM = require 'react-dom'
ReactTestUtils = require('react-addons-test-utils')
ThreadSearchBar = require('../lib/thread-search-bar').default
SearchActions = require('../lib/search-actions').default
describe 'ThreadSearchBar', ->
beforeEach ->
spyOn(NylasEnv, "isMainWindow").andReturn true
@searchBar = ReactTestUtils.renderIntoDocument(<ThreadSearchBar />)
@input = ReactDOM.findDOMNode(@searchBar).querySelector("input")
it 'supports search queries with a colon character', ->
spyOn(SearchActions, "queryChanged")
test = "::Hello: World::"
ReactTestUtils.Simulate.change @input, target: value: test
expect(SearchActions.queryChanged).toHaveBeenCalledWith(test)
it 'preserves capitalization on searches', ->
test = "HeLlO wOrLd"
ReactTestUtils.Simulate.change @input, target: value: test
waitsFor =>
@input.value.length > 0
runs =>
expect(@input.value).toBe(test)