     @locationBadgeEl.children().length
 
   resetSearchState: ->
-    # Remove scope
-    @scopeInputEl.val('')
-
-    # Remove group
-    @groupInputEl.val('')
-
-    # Remove project id
-    @projectInputEl.val('')
-
-    # Remove code search
-    @searchCodeInputEl.val('')
-
-    # Remove repository ref
-    @repositoryInputEl.val('')
+    inputs = Object.keys @originalState
+
+    for input in inputs
+
+      # _location isnt a input
+      break if input is '_location'
+
+      # renamed to avoid tests to fail
+      if input is 'project_id' then input = 'search_project_id'
+
+      @getElement("##{input}").val('')
 
   removeLocationBadge: ->
     @locationBadgeEl.empty()

    @groupInputEl = @getElement('#group_id')
    @searchCodeInputEl = @getElement('#search_code')
    @repositoryInputEl = @getElement('#repository_ref')
    @scopeInputEl = @getElement('#scope')

    @saveOriginalState()


      group_id: @groupInputEl.val()
      search_code: @searchCodeInputEl.val()
      repository_ref: @repositoryInputEl.val()
      scope: @scopeInputEl.val()

      # Location badge
      _location: $.trim(@locationText.text())
