Mailspring/internal_packages/search-bar/spec/search-bar-spec.cjsx
Ben Gotow 886328ff7a bump(react): 0.13.2 => 0.14.7
Great breakdown of React changes here:
https://github.com/facebook/react/blob/master/CHANGELOG.md#0140-october-7-2015

Due to deprecation warnings, I don't think this will break third-party extensions unless they were doing really bad things.
2016-03-29 01:43:12 -07:00

28 lines
981 B
CoffeeScript

React = require 'react'
ReactDOM = require 'react-dom'
ReactTestUtils = require('react-addons-test-utils')
SearchBar = require '../lib/search-bar'
SearchActions = require '../lib/search-actions'
SearchSuggestionStore = require '../lib/search-suggestion-store'
describe 'SearchBar', ->
beforeEach ->
spyOn(NylasEnv, "isMainWindow").andReturn true
@searchBar = ReactTestUtils.renderIntoDocument(<SearchBar />)
@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)