Skip to content

Commit 013c40d

Browse files
committed
add test case for something like use case described in issue burnettk#6
1 parent 27c19e7 commit 013c40d

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

spec/gf_file_spec.rb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,36 @@
5050
current_file_name.should eq "directive.js"
5151
end
5252

53+
specify "the gelus use case from github issue #4" do
54+
html_file_at('partials/widgets/clustering-widget.html')
55+
do_gf_from_directive_that_references!('partials/widgets/clustering-widget.html', 'clustering')
56+
current_file_name.should eq "partials/widgets/clustering-widget.html"
57+
end
58+
5359
private
5460

5561
def html_file_at(filename)
5662
safe_write_file(filename)
5763
end
5864

59-
def do_gf(starting_file, starting_file_contents)
65+
def do_gf(starting_file, starting_file_contents, search_term = default_search_term)
6066
write_file(starting_file, starting_file_contents)
6167

6268
vim.edit starting_file
6369
current_file_name.should eq starting_file
64-
vim.normal '/my-cust<CR>'
65-
#vim.normal 'gf'
70+
vim.normal "/#{search_term}<CR>"
71+
# vim.normal 'gf' # does not pick up some aspect of setting up this mapping in the autocmd
6672
vim.command 'AngularGoToFile'
6773
end
6874

69-
def do_gf_from_directive_that_references!(template_url)
75+
def default_search_term
76+
'my-cust'
77+
end
78+
79+
def do_gf_from_directive_that_references!(template_url, search_term = default_search_term)
7080
starting_file = 'directive.js'
7181

72-
do_gf(starting_file, <<-EOF)
82+
directive_file_contents = <<-EOF
7383
angular.module('docsTemplateUrlDirective', [])
7484
.controller('Controller', ['$scope', function($scope) {
7585
$scope.customer = {
@@ -83,6 +93,8 @@ def do_gf_from_directive_that_references!(template_url)
8393
};
8494
});
8595
EOF
96+
97+
do_gf(starting_file, directive_file_contents, search_term)
8698
end
8799

88100
def do_gf_from_view_that_references!(template_url)

0 commit comments

Comments
 (0)