Mailspring/app/internal_packages/thread-search/specs/search-bar-spec.cjsx

27 lines
954 B
Text
Raw Normal View History

React = require 'react'
ReactDOM = require 'react-dom'
ReactTestUtils = require('react-dom/test-utils')
ThreadSearchBar = require('../lib/thread-search-bar').default
SearchActions = require('../lib/search-actions').default
describe 'ThreadSearchBar', ->
beforeEach ->
2017-09-27 02:36:58 +08:00
spyOn(AppEnv, "isMainWindow").andReturn true
@searchBar = ReactTestUtils.renderIntoDocument(<ThreadSearchBar />)
@input = ReactDOM.findDOMNode(@searchBar).querySelector("input")
it 'supports search queries with a colon character', ->
2016-01-12 07:58:10 +08:00
spyOn(SearchActions, "queryChanged")
test = "::Hello: World::"
ReactTestUtils.Simulate.change @input, target: value: test
expect(SearchActions.queryChanged).toHaveBeenCalledWith(test)
2016-01-12 07:58:10 +08:00
it 'preserves capitalization on searches', ->
test = "HeLlO wOrLd"
ReactTestUtils.Simulate.change @input, target: value: test
waitsFor =>
@input.value.length > 0
runs =>
2016-01-12 07:58:10 +08:00
expect(@input.value).toBe(test)