Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Unit Tests for Find, Replace, Find in Files, File Filters#7328

Merged
RaymondLim merged 14 commits intomasterfrom
randy/find-replace-unit-tests
Apr 17, 2014
Merged

Unit Tests for Find, Replace, Find in Files, File Filters#7328
RaymondLim merged 14 commits intomasterfrom
randy/find-replace-unit-tests

Conversation

@redmunds
Copy link
Copy Markdown
Contributor

https://trello.com/c/qvHL6r4i/45-unit-tests-for-existing-find-replace-find-in-files-features


Find

  • Invoke Find with selection (make sure search text is selection)
    • added: "should get single selection as initial query"
  • Invoke Find without selection (make sure search text is empty)
    • added: "should use empty initial query for single cursor selection", and
    • added: "should use empty initial query for multiple cursor selection"
  • Invoke Find next while Find is open with no text
    • existing: "should no-op on Find Next with blank search"
  • Invoke Find to ensure all tickmarks are present and results are highlighted
    • added: "should have a scroll track marker for every match"
  • Invoke Find with Case sensitive to ensure that all case sensitive matches are found
    • existing: "should find all case-sensitive matches with mixed-case text"
    • existing: "should support case-sensitive regexp"
  • Invoke Find without Case sensitive to ensure that all matches are found
    • existing: "should find all case-insensitive matches with lowercase text"
    • existing: "should find all case-insensitive matches with mixed-case text"
    • existing: "should support case-insensitive regexp"
  • Invoke Find with Regex to ensure that regex is found
    • existing: "should find based on regexp"
    • existing: "should support case-sensitive regexp"
    • existing: "should support case-insensitive regexp"

Replace

  • Invoke Replace with a selection (make sure search text is selection)
    • added: "should get single selection as initial query"
  • Invoke Replace without a selection (make sure search text is empty)
    • added: "should use empty initial query for single cursor selection", and
    • added: "should use empty initial query for multiple cursor selection"
  • Invoke Replace with plain text
    • existing: "should find and replace one string"
    • existing: "should use replace keyboard shortcut for single Replace while search bar open"
  • Invoke Replace All with Plain text to ensure all instances are replaced
    • added: "should find and replace all"
  • Invoke Replace with RegEx
    • existing: "should find and replace a regexp with $n substitutions", etc.
  • Invoke Replace with Regex capture groups and replace parameter
    • existing: "should find and replace a regexp with $n substitutions"
  • Replace Yes/No/Skip to ensure next instance is found
    • added: "should find and skip then replace string"
  • Replace Yes/No/Skip to ensure instance is Replaced or Not
    • added: "should find and skip then replace string"

Find in Files

Added tests for:

  • Results for Project are displayed
  • Results for Folder are displayed
  • Results for File are displayed
  • Start and End offsets are found
  • Dialog is dismissed and Panel is displayed for Results
  • Dialog is kept and Panel is not displayed for No Results
  • More than 100 Results are paginated
    • Doesn't seem like it worth the effort
  • Selecting a Result changes to that file, scrolls to that line, and text is selected
  • Double-click on a Result adds file to Working Set
  • Change one of the find hits to ensure results panel is updated

File Filters

Added tests for:

  • Respect file exclusion filter when searching project
  • Respect file exclusion filter when searching folder
  • Ignore file exclusion filter when searching single file
  • Show error if file exclusion filter results in zero files to search

@JeffryBooher JeffryBooher changed the title FindReplace unit tests [REVIEW ONLY] FindReplace unit tests Mar 26, 2014
@redmunds
Copy link
Copy Markdown
Contributor Author

@JeffryBooher Here's an update on where I at with this pull request.

I copied the Tasks lists from the Kanban card to here so I could add notes and check them off as I go. Note that some of the suggested tests already existed, so I marked them accordingly.

I think tests for Find and Replace are done. There were no tests suggested for Find Next, but I think it's covered pretty well. There was only 1 test suggested for Find in Files and no existing tests, so I added a list of other tests.

Review and add comments on tests that need improvement and add any tests to the list that are missing. You're welcome to start writing some of the missing tests, but I don't think that this needs to get in for Sprint 38, so no hurry.

/cc: @peterflynn, @TomMalbran (who wrote a lot of this code)

Comment thread src/brackets.js
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that adding ScrollTrackMarkers was the only logical change here -- the rest was ordering alphabetically to make it easier to see what's in list.

@redmunds redmunds changed the title [REVIEW ONLY] FindReplace unit tests More Unit Tests for Find, Replace, Find in Files, File Filters Apr 10, 2014
@redmunds redmunds changed the title More Unit Tests for Find, Replace, Find in Files, File Filters Unit Tests for Find, Replace, Find in Files, File Filters Apr 10, 2014
Comment thread src/search/ScrollTrackMarkers.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: shouldn't we call it _getTickmarks since we have another one called addTickmarks below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@RaymondLim
Copy link
Copy Markdown
Contributor

Looks good. Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants