@@ -1699,6 +1699,52 @@ define(function (require, exports, module) {
16991699 } ) ;
17001700
17011701 describe ( "Full workflow" , function ( ) {
1702+ it ( "should prepopulate the find bar with selected text" , function ( ) {
1703+ var doc , editor ;
1704+
1705+ openTestProjectCopy ( defaultSourcePath ) ;
1706+ runs ( function ( ) {
1707+ waitsForDone ( CommandManager . execute ( Commands . FILE_ADD_TO_WORKING_SET , { fullPath : testPath + "/foo.html" } ) , "open file" ) ;
1708+ } ) ;
1709+ runs ( function ( ) {
1710+ doc = DocumentManager . getOpenDocumentForPath ( testPath + "/foo.html" ) ;
1711+ expect ( doc ) . toBeTruthy ( ) ;
1712+ DocumentManager . setCurrentDocument ( doc ) ;
1713+ editor = doc . _masterEditor ;
1714+ expect ( editor ) . toBeTruthy ( ) ;
1715+ editor . setSelection ( { line : 4 , ch : 7 } , { line : 4 , ch : 10 } ) ;
1716+ } ) ;
1717+
1718+ openSearchBar ( null ) ;
1719+ runs ( function ( ) {
1720+ expect ( $ ( "#find-what" ) . val ( ) ) . toBe ( "Foo" ) ;
1721+ } ) ;
1722+ waitsForDone ( CommandManager . execute ( Commands . FILE_CLOSE_ALL ) , "closing all files" ) ;
1723+ } ) ;
1724+
1725+ it ( "should prepopulate the find bar with only first line of selected text" , function ( ) {
1726+ var doc , editor ;
1727+
1728+ openTestProjectCopy ( defaultSourcePath ) ;
1729+ runs ( function ( ) {
1730+ waitsForDone ( CommandManager . execute ( Commands . FILE_ADD_TO_WORKING_SET , { fullPath : testPath + "/foo.html" } ) , "open file" ) ;
1731+ } ) ;
1732+ runs ( function ( ) {
1733+ doc = DocumentManager . getOpenDocumentForPath ( testPath + "/foo.html" ) ;
1734+ expect ( doc ) . toBeTruthy ( ) ;
1735+ DocumentManager . setCurrentDocument ( doc ) ;
1736+ editor = doc . _masterEditor ;
1737+ expect ( editor ) . toBeTruthy ( ) ;
1738+ editor . setSelection ( { line : 4 , ch : 7 } , { line : 6 , ch : 10 } ) ;
1739+ } ) ;
1740+
1741+ openSearchBar ( null ) ;
1742+ runs ( function ( ) {
1743+ expect ( $ ( "#find-what" ) . val ( ) ) . toBe ( "Foo</title>" ) ;
1744+ } ) ;
1745+ waitsForDone ( CommandManager . execute ( Commands . FILE_CLOSE_ALL ) , "closing all files" ) ;
1746+ } ) ;
1747+
17021748 it ( "should show results from the search with all checkboxes checked" , function ( ) {
17031749 showSearchResults ( "foo" , "bar" ) ;
17041750 runs ( function ( ) {
0 commit comments