yard-cucumber2 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +37 -0
- data/History.txt +274 -0
- data/LICENSE.txt +22 -0
- data/README.md +188 -0
- data/Rakefile +25 -0
- data/example/README.md +8 -0
- data/example/child_feature/README.md +21 -0
- data/example/child_feature/child.feature +11 -0
- data/example/child_feature/grandchild_feature/grandchild.feature +12 -0
- data/example/empty.feature +2 -0
- data/example/french.feature +18 -0
- data/example/scenario.feature +63 -0
- data/example/scenario_outline.feature +94 -0
- data/example/scenario_outline_multi.feature +15 -0
- data/example/step_definitions/example.step.rb +109 -0
- data/example/step_definitions/first.step.rb +21 -0
- data/example/step_definitions/french_steps.rb +32 -0
- data/example/step_definitions/struct.rb +11 -0
- data/example/step_definitions/support/env.rb +7 -0
- data/example/step_definitions/support/env_support.rb +12 -0
- data/example/step_definitions/support/support.rb +6 -0
- data/example/tags.feature +18 -0
- data/example/transform.feature +13 -0
- data/lib/cucumber/city_builder.rb +331 -0
- data/lib/docserver/default/fulldoc/html/js/cucumber.js +85 -0
- data/lib/docserver/default/layout/html/headers.erb +14 -0
- data/lib/docserver/doc_server/full_list/html/full_list.erb +39 -0
- data/lib/docserver/doc_server/full_list/html/setup.rb +18 -0
- data/lib/templates/default/feature/html/feature.erb +39 -0
- data/lib/templates/default/feature/html/no_steps_defined.erb +1 -0
- data/lib/templates/default/feature/html/outline.erb +56 -0
- data/lib/templates/default/feature/html/pystring.erb +3 -0
- data/lib/templates/default/feature/html/scenario.erb +55 -0
- data/lib/templates/default/feature/html/setup.rb +55 -0
- data/lib/templates/default/feature/html/steps.erb +39 -0
- data/lib/templates/default/feature/html/table.erb +20 -0
- data/lib/templates/default/featuredirectory/html/alpha_table.erb +30 -0
- data/lib/templates/default/featuredirectory/html/directory.erb +32 -0
- data/lib/templates/default/featuredirectory/html/setup.rb +41 -0
- data/lib/templates/default/featuretags/html/namespace.erb +131 -0
- data/lib/templates/default/featuretags/html/setup.rb +34 -0
- data/lib/templates/default/fulldoc/html/css/cucumber.css +227 -0
- data/lib/templates/default/fulldoc/html/directories.erb +53 -0
- data/lib/templates/default/fulldoc/html/full_list_featuredirectories.erb +11 -0
- data/lib/templates/default/fulldoc/html/full_list_features.erb +29 -0
- data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +16 -0
- data/lib/templates/default/fulldoc/html/full_list_steps.erb +17 -0
- data/lib/templates/default/fulldoc/html/full_list_tags.erb +12 -0
- data/lib/templates/default/fulldoc/html/js/cucumber.js +305 -0
- data/lib/templates/default/fulldoc/html/setup.rb +175 -0
- data/lib/templates/default/layout/html/setup.rb +56 -0
- data/lib/templates/default/requirements/html/alpha_table.erb +26 -0
- data/lib/templates/default/requirements/html/requirements.erb +50 -0
- data/lib/templates/default/requirements/html/setup.rb +51 -0
- data/lib/templates/default/steptransformers/html/header.erb +12 -0
- data/lib/templates/default/steptransformers/html/index.erb +10 -0
- data/lib/templates/default/steptransformers/html/setup.rb +94 -0
- data/lib/templates/default/steptransformers/html/transformers.erb +79 -0
- data/lib/templates/default/steptransformers/html/undefinedsteps.erb +26 -0
- data/lib/templates/default/tag/html/alpha_table.erb +32 -0
- data/lib/templates/default/tag/html/setup.rb +27 -0
- data/lib/templates/default/tag/html/tag.erb +35 -0
- data/lib/yard-cucumber.rb +47 -0
- data/lib/yard-cucumber/version.rb +3 -0
- data/lib/yard/code_objects/cucumber/base.rb +32 -0
- data/lib/yard/code_objects/cucumber/feature.rb +18 -0
- data/lib/yard/code_objects/cucumber/namespace_object.rb +49 -0
- data/lib/yard/code_objects/cucumber/scenario.rb +26 -0
- data/lib/yard/code_objects/cucumber/scenario_outline.rb +75 -0
- data/lib/yard/code_objects/cucumber/step.rb +38 -0
- data/lib/yard/code_objects/cucumber/tag.rb +27 -0
- data/lib/yard/code_objects/step_definition.rb +7 -0
- data/lib/yard/code_objects/step_transform.rb +7 -0
- data/lib/yard/code_objects/step_transformer.rb +97 -0
- data/lib/yard/handlers/cucumber/base.rb +21 -0
- data/lib/yard/handlers/cucumber/feature_handler.rb +131 -0
- data/lib/yard/handlers/legacy/step_definition_handler.rb +45 -0
- data/lib/yard/handlers/legacy/step_transform_handler.rb +24 -0
- data/lib/yard/handlers/step_definition_handler.rb +86 -0
- data/lib/yard/handlers/step_transform_handler.rb +31 -0
- data/lib/yard/parser/cucumber/feature.rb +73 -0
- data/lib/yard/server/adapter.rb +43 -0
- data/lib/yard/server/commands/list_command.rb +31 -0
- data/lib/yard/server/router.rb +32 -0
- data/lib/yard/templates/helpers/base_helper.rb +26 -0
- data/yard-cucumber.gemspec +65 -0
- metadata +199 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
#
|
2
|
+
# @see https://github.com/burtlo/yard-cucumber/issues/18
|
3
|
+
#
|
4
|
+
CustomerUsageBehavior = Struct.new(:weight, :days, :time, :location, :other_party, :usage_type, :direction, :quantity)
|
5
|
+
|
6
|
+
|
7
|
+
class CustomerProfile
|
8
|
+
def generate_winner(max=@total_weight)
|
9
|
+
# blah
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
@tags
|
2
|
+
Feature: Tags
|
3
|
+
As a developer of the test suite I expect that various tags will be supported
|
4
|
+
|
5
|
+
@tag
|
6
|
+
Scenario: Basic Tag
|
7
|
+
|
8
|
+
@tag123456
|
9
|
+
Scenario: Tag With Numbers
|
10
|
+
|
11
|
+
@tag_with_underscore
|
12
|
+
Scenario: Tag With Underscore
|
13
|
+
|
14
|
+
@tag-with-dash
|
15
|
+
Scenario: Tag With Dash
|
16
|
+
|
17
|
+
@tag+with+plus
|
18
|
+
Scenario: Tag With Plus
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@scenarios @bvt
|
2
|
+
Feature: Step Transforms
|
3
|
+
As a developer of the test suite I expect that step transforms are documented correctly
|
4
|
+
|
5
|
+
@first
|
6
|
+
Scenario: Step with step transformation
|
7
|
+
Given this scenario step
|
8
|
+
Then I expect that the step, on the step transformer page, will link to the step transform
|
9
|
+
|
10
|
+
@second
|
11
|
+
Scenario: Step Transform uses a constant
|
12
|
+
Given this first step
|
13
|
+
Then I expect that the step, on the step transformer page, will link to the step transform
|
@@ -0,0 +1,331 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Parser
|
3
|
+
class CityBuilder
|
4
|
+
include Gherkin::Rubify
|
5
|
+
|
6
|
+
#
|
7
|
+
# The Gherkin Parser is going to call the various methods within this
|
8
|
+
# class as it finds items. This is similar to how Cucumber generates
|
9
|
+
# it's Abstract Syntax Tree (AST). Here instead this generates the
|
10
|
+
# various YARD::CodeObjects defined within this template.
|
11
|
+
#
|
12
|
+
# A namespace is specified and that is the place in the YARD namespacing
|
13
|
+
# where all cucumber features generated will reside. The namespace specified
|
14
|
+
# is the root namespaces.
|
15
|
+
#
|
16
|
+
# @param [String] file the name of the file which the content belongs
|
17
|
+
#
|
18
|
+
def initialize(file)
|
19
|
+
@namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
|
20
|
+
find_or_create_namespace(file)
|
21
|
+
@file = file
|
22
|
+
end
|
23
|
+
|
24
|
+
# Return the feature that has been defined. This method is the final
|
25
|
+
# method that is called when all the work is done. It is called by
|
26
|
+
# the feature parser to return the complete Feature object that was created
|
27
|
+
#
|
28
|
+
# @return [YARD::CodeObject::Cucumber::Feature] the completed feature
|
29
|
+
#
|
30
|
+
# @see YARD::Parser::Cucumber::FeatureParser
|
31
|
+
def ast
|
32
|
+
@feature
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Feature that are found in sub-directories are considered, in the way
|
37
|
+
# that I chose to implement it, in another namespace. This is because
|
38
|
+
# when you execute a cucumber test run on a directory any sub-directories
|
39
|
+
# of features will be executed with that directory so the file is split
|
40
|
+
# and then namespaces are generated if they have not already have been.
|
41
|
+
#
|
42
|
+
# The other duty that this does is look for a README.md file within the
|
43
|
+
# specified directory of the file and loads it as the description for the
|
44
|
+
# namespace. This is useful if you want to give a particular directory
|
45
|
+
# some flavor or text to describe what is going on.
|
46
|
+
#
|
47
|
+
def find_or_create_namespace(file)
|
48
|
+
@namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
|
49
|
+
|
50
|
+
File.dirname(file).split('/').each do |directory|
|
51
|
+
@namespace = @namespace.children.find {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) && child.name.to_s == directory } ||
|
52
|
+
@namespace = YARD::CodeObjects::Cucumber::FeatureDirectory.new(@namespace,directory) {|dir| dir.add_file(directory)}
|
53
|
+
end
|
54
|
+
|
55
|
+
if @namespace.description == "" && File.exists?("#{File.dirname(file)}/README.md")
|
56
|
+
@namespace.description = File.read("#{File.dirname(file)}/README.md")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# Find the tag if it exists within the YARD Registry, if it doesn' t then
|
62
|
+
# create it.
|
63
|
+
#
|
64
|
+
# We note that the tag was used in this file at the current line.
|
65
|
+
#
|
66
|
+
# Then we add the tag to the current scenario or feature. We also add the
|
67
|
+
# feature or scenario to the tag.
|
68
|
+
#
|
69
|
+
# @param [String] tag_name the name of the tag
|
70
|
+
# @param [parent] parent the scenario or feature that is going to adopt
|
71
|
+
# this tag.
|
72
|
+
#
|
73
|
+
def find_or_create_tag(tag_name,parent)
|
74
|
+
#log.debug "Processing tag #{tag_name}"
|
75
|
+
tag_code_object = YARD::Registry.all(:tag).find {|tag| tag.value == tag_name } ||
|
76
|
+
YARD::CodeObjects::Cucumber::Tag.new(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE,tag_name.gsub('@','')) {|t| t.owners = [] ; t.value = tag_name }
|
77
|
+
|
78
|
+
tag_code_object.add_file(@file,parent.line)
|
79
|
+
|
80
|
+
parent.tags << tag_code_object unless parent.tags.find {|tag| tag == tag_code_object }
|
81
|
+
tag_code_object.owners << parent unless tag_code_object.owners.find {|owner| owner == parent}
|
82
|
+
end
|
83
|
+
|
84
|
+
#
|
85
|
+
# Each feature found will call this method, generating the feature object.
|
86
|
+
# This is once, as the gherking parser does not like multiple feature per
|
87
|
+
# file.
|
88
|
+
#
|
89
|
+
def feature(feature)
|
90
|
+
#log.debug "FEATURE"
|
91
|
+
|
92
|
+
@feature = YARD::CodeObjects::Cucumber::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|
|
93
|
+
f.comments = feature.comments.map{|comment| comment.value}.join("\n")
|
94
|
+
f.description = feature.description
|
95
|
+
f.add_file(@file,feature.line)
|
96
|
+
f.keyword = feature.keyword
|
97
|
+
f.value = feature.name
|
98
|
+
f.tags = []
|
99
|
+
|
100
|
+
feature.tags.each {|feature_tag| find_or_create_tag(feature_tag.name,f) }
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Called when a background has been found
|
106
|
+
#
|
107
|
+
# @see #scenario
|
108
|
+
def background(background)
|
109
|
+
#log.debug "BACKGROUND"
|
110
|
+
|
111
|
+
@background = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"background") do |b|
|
112
|
+
b.comments = background.comments.map{|comment| comment.value}.join("\n")
|
113
|
+
b.description = background.description
|
114
|
+
b.keyword = background.keyword
|
115
|
+
b.value = background.name
|
116
|
+
b.add_file(@file,background.line)
|
117
|
+
end
|
118
|
+
|
119
|
+
@feature.background = @background
|
120
|
+
@background.feature = @feature
|
121
|
+
@step_container = @background
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Called when a scenario has been found
|
126
|
+
# - create a scenario
|
127
|
+
# - assign the scenario to the feature
|
128
|
+
# - assign the feature to the scenario
|
129
|
+
# - find or create tags associated with the scenario
|
130
|
+
#
|
131
|
+
# The scenario is set as the @step_container, which means that any steps
|
132
|
+
# found before another scenario is defined belong to this scenario
|
133
|
+
#
|
134
|
+
# @param [Scenario] statement is a scenario object returned from Gherkin
|
135
|
+
# @see #find_or_create_tag
|
136
|
+
#
|
137
|
+
def scenario(statement)
|
138
|
+
#log.debug "SCENARIO"
|
139
|
+
|
140
|
+
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
141
|
+
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
142
|
+
s.description = statement.description
|
143
|
+
s.add_file(@file,statement.line)
|
144
|
+
s.keyword = statement.keyword
|
145
|
+
s.value = statement.name
|
146
|
+
|
147
|
+
statement.tags.each {|scenario_tag| find_or_create_tag(scenario_tag.name,s) }
|
148
|
+
end
|
149
|
+
|
150
|
+
scenario.feature = @feature
|
151
|
+
@feature.scenarios << scenario
|
152
|
+
@step_container = scenario
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# Called when a scenario outline is found. Very similar to a scenario,
|
157
|
+
# the ScenarioOutline is still a distinct object as it can contain
|
158
|
+
# multiple different example groups that can contain different values.
|
159
|
+
#
|
160
|
+
# @see #scenario
|
161
|
+
#
|
162
|
+
def scenario_outline(statement)
|
163
|
+
#log.debug "SCENARIO OUTLINE"
|
164
|
+
|
165
|
+
outline = YARD::CodeObjects::Cucumber::ScenarioOutline.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
166
|
+
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
167
|
+
s.description = statement.description
|
168
|
+
s.add_file(@file,statement.line)
|
169
|
+
s.keyword = statement.keyword
|
170
|
+
s.value = statement.name
|
171
|
+
|
172
|
+
statement.tags.each {|scenario_tag| find_or_create_tag(scenario_tag.name,s) }
|
173
|
+
end
|
174
|
+
|
175
|
+
outline.feature = @feature
|
176
|
+
@feature.scenarios << outline
|
177
|
+
@step_container = outline
|
178
|
+
end
|
179
|
+
|
180
|
+
#
|
181
|
+
# Examples for a scenario outline are called here. This section differs
|
182
|
+
# from the Cucumber parser because here each of the examples are exploded
|
183
|
+
# out here as individual scenarios and step definitions. This is so that
|
184
|
+
# later we can ensure that we have all the variations of the scenario
|
185
|
+
# outline defined to be displayed.
|
186
|
+
#
|
187
|
+
def examples(examples)
|
188
|
+
#log.debug "EXAMPLES"
|
189
|
+
|
190
|
+
example = YARD::CodeObjects::Cucumber::ScenarioOutline::Examples.new(:keyword => examples.keyword,
|
191
|
+
:name => examples.name,
|
192
|
+
:line => examples.line,
|
193
|
+
:comments => examples.comments.map{|comment| comment.value}.join("\n"),
|
194
|
+
:rows => matrix(examples.rows))
|
195
|
+
|
196
|
+
|
197
|
+
# add the example to the step containers list of examples
|
198
|
+
|
199
|
+
@step_container.examples << example
|
200
|
+
|
201
|
+
# For each example data row we want to generate a new scenario using our
|
202
|
+
# current scenario as the template.
|
203
|
+
|
204
|
+
example.data.length.times do |row_index|
|
205
|
+
|
206
|
+
# Generate a copy of the scenario.
|
207
|
+
|
208
|
+
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@step_container,"example_#{@step_container.scenarios.length + 1}") do |s|
|
209
|
+
s.comments = @step_container.comments
|
210
|
+
s.description = @step_container.description
|
211
|
+
s.add_file(@file,@step_container.line_number)
|
212
|
+
s.keyword = @step_container.keyword
|
213
|
+
s.value = "#{@step_container.value} (#{@step_container.scenarios.length + 1})"
|
214
|
+
end
|
215
|
+
|
216
|
+
# Generate a copy of the scenario steps.
|
217
|
+
|
218
|
+
@step_container.steps.each do |step|
|
219
|
+
step_instance = YARD::CodeObjects::Cucumber::Step.new(scenario,step.line_number) do |s|
|
220
|
+
s.keyword = step.keyword.dup
|
221
|
+
s.value = step.value.dup
|
222
|
+
s.add_file(@file,step.line_number)
|
223
|
+
|
224
|
+
s.text = step.text.dup if step.has_text?
|
225
|
+
s.table = clone_table(step.table) if step.has_table?
|
226
|
+
end
|
227
|
+
|
228
|
+
# Look at the particular data for the example row and do a simple
|
229
|
+
# find and replace of the <key> with the associated values.
|
230
|
+
|
231
|
+
example.values_for_row(row_index).each do |key,text|
|
232
|
+
text ||= "" #handle empty cells in the example table
|
233
|
+
step_instance.value.gsub!("<#{key}>",text)
|
234
|
+
step_instance.text.gsub!("<#{key}>",text) if step_instance.has_text?
|
235
|
+
step_instance.table.each{|row| row.each{|col| col.gsub!("<#{key}>",text)}} if step_instance.has_table?
|
236
|
+
end
|
237
|
+
|
238
|
+
# Connect these steps that we created to the scenario we created
|
239
|
+
# and then add the steps to the scenario created.
|
240
|
+
|
241
|
+
step_instance.scenario = scenario
|
242
|
+
scenario.steps << step_instance
|
243
|
+
end
|
244
|
+
|
245
|
+
# Add the scenario to the list of scenarios maintained by the feature
|
246
|
+
# and add the feature to the scenario
|
247
|
+
|
248
|
+
scenario.feature = @feature
|
249
|
+
@step_container.scenarios << scenario
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
#
|
256
|
+
# Called when a step is found. The step is refered to a table owner, though
|
257
|
+
# not all steps have a table or multliline arguments associated with them.
|
258
|
+
#
|
259
|
+
# If a multiline string is present with the step it is included as the text
|
260
|
+
# of the step. If the step has a table it is added to the step using the
|
261
|
+
# same method used by the Cucumber Gherkin model.
|
262
|
+
#
|
263
|
+
def step(step)
|
264
|
+
#log.debug "STEP"
|
265
|
+
|
266
|
+
@table_owner = YARD::CodeObjects::Cucumber::Step.new(@step_container,"#{step.line}") do |s|
|
267
|
+
s.keyword = step.keyword
|
268
|
+
s.value = step.name
|
269
|
+
s.add_file(@file,step.line)
|
270
|
+
end
|
271
|
+
|
272
|
+
@table_owner.comments = step.comments.map{|comment| comment.value}.join("\n")
|
273
|
+
|
274
|
+
multiline_arg = if step.respond_to?(:multiline_arg) && !step.multiline_arg.nil?
|
275
|
+
rubify(step.multiline_arg)
|
276
|
+
elsif step.respond_to?(:rows) && !step.rows.nil?
|
277
|
+
rubify(step.rows)
|
278
|
+
elsif step.respond_to?(:doc_string) && !step.doc_string.nil?
|
279
|
+
rubify(step.doc_string)
|
280
|
+
end
|
281
|
+
|
282
|
+
case(multiline_arg)
|
283
|
+
when gherkin_multiline_string_class
|
284
|
+
@table_owner.text = multiline_arg.value
|
285
|
+
when Array
|
286
|
+
#log.info "Matrix: #{matrix(multiline_arg).collect{|row| row.collect{|cell| cell.class } }.flatten.join("\n")}"
|
287
|
+
@table_owner.table = matrix(multiline_arg)
|
288
|
+
end
|
289
|
+
|
290
|
+
@table_owner.scenario = @step_container
|
291
|
+
@step_container.steps << @table_owner
|
292
|
+
end
|
293
|
+
|
294
|
+
# Defined in the cucumber version so left here. No events for the end-of-file
|
295
|
+
def eof
|
296
|
+
end
|
297
|
+
|
298
|
+
# When a syntax error were to occurr. This parser is not interested in errors
|
299
|
+
def syntax_error(state, event, legal_events, line)
|
300
|
+
# raise "SYNTAX ERROR"
|
301
|
+
end
|
302
|
+
|
303
|
+
private
|
304
|
+
def matrix(gherkin_table)
|
305
|
+
gherkin_table.map {|gherkin_row| gherkin_row.cells }
|
306
|
+
end
|
307
|
+
|
308
|
+
#
|
309
|
+
# This helper method is used to deteremine what class is the current
|
310
|
+
# Gherkin class.
|
311
|
+
#
|
312
|
+
# @return [Class] the class that is the current supported Gherkin Model
|
313
|
+
# for multiline strings. Prior to Gherkin 2.4.0 this was the PyString
|
314
|
+
# class. As of Gherkin 2.4.0 it is the DocString class.
|
315
|
+
def gherkin_multiline_string_class
|
316
|
+
if defined?(Gherkin::Formatter::Model::PyString)
|
317
|
+
Gherkin::Formatter::Model::PyString
|
318
|
+
elsif defined?(Gherkin::Formatter::Model::DocString)
|
319
|
+
Gherkin::Formatter::Model::DocString
|
320
|
+
else
|
321
|
+
raise "Unable to find a suitable class in the Gherkin Library to parse the multiline step data."
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
def clone_table(base)
|
326
|
+
base.map {|row| row.map {|cell| cell.dup }}
|
327
|
+
end
|
328
|
+
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
function cucumberSearchFrameLinks() {
|
2
|
+
$('#feature_list_link').click(function() {
|
3
|
+
toggleSearchFrame(this, '/' + library + '/features');
|
4
|
+
});
|
5
|
+
$('#tag_list_link').click(function() {
|
6
|
+
toggleSearchFrame(this, '/' + library + '/tags');
|
7
|
+
});
|
8
|
+
}
|
9
|
+
|
10
|
+
$(cucumberSearchFrameLinks);
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
function toggleScenarioExample(id,example) {
|
15
|
+
|
16
|
+
var element = $("#" + id + "Example" + example + "Steps")[0];
|
17
|
+
|
18
|
+
$('#' + id + ' tr').each(function(index) {
|
19
|
+
this.style.backgroundColor = (index % 2 == 0 ? '#FFFFFF' : '#F0F6F9' );
|
20
|
+
});
|
21
|
+
|
22
|
+
if (element.style.display != 'none') {
|
23
|
+
element = $("#" + id + "Steps")[0];
|
24
|
+
} else {
|
25
|
+
$('#' + id + ' .outline * tr')[example].style.backgroundColor = '#FFCC80';
|
26
|
+
}
|
27
|
+
|
28
|
+
$('#' + id + ' .steps').each(function(index) {
|
29
|
+
this.style.display = 'none';
|
30
|
+
});
|
31
|
+
|
32
|
+
element.style.display = 'block';
|
33
|
+
|
34
|
+
}
|
35
|
+
|
36
|
+
function determine_tags_used_in_formula(tag_string) {
|
37
|
+
//$("#tag_debug")[0].innerHTML = "";
|
38
|
+
|
39
|
+
tag_string = tag_string.replace(/^(\s+)|(\s+)$/,'').replace(/\s{2,}/,' ');
|
40
|
+
|
41
|
+
var tags = tag_string.match(/@\w+/g);
|
42
|
+
|
43
|
+
var return_tags = [];
|
44
|
+
|
45
|
+
if (tags != null) {
|
46
|
+
tags.forEach(function(tag, index, array) {
|
47
|
+
//$("#tag_debug")[0].innerHTML += tag + " ";
|
48
|
+
if (tag_list.indexOf(tag) != -1) { return_tags.push(tag); }
|
49
|
+
});
|
50
|
+
}
|
51
|
+
|
52
|
+
return return_tags;
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
function display_example_command_line(tags) {
|
57
|
+
$("#command_example")[0].innerHTML = "cucumber ";
|
58
|
+
|
59
|
+
if (tags.length > 0) {
|
60
|
+
$("#command_example")[0].innerHTML += "--tags " + tags.join(" --tags ");
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
function display_qualifying_features_and_scenarios(tags) {
|
65
|
+
//$("#tag_debug")[0].innerHTML = "";
|
66
|
+
|
67
|
+
if (tags.length > 0) {
|
68
|
+
|
69
|
+
$(".feature,.scenario").each(function(feature){
|
70
|
+
this.style.display = "none";
|
71
|
+
});
|
72
|
+
|
73
|
+
$(".feature.\\" + tags.join(".\\") + ",.scenario.\\" + tags.join(".\\")).each(function(feature) {
|
74
|
+
//$("#tag_debug")[0].innerHTML += feature + " " + this;
|
75
|
+
this.style.display = "block";
|
76
|
+
});
|
77
|
+
|
78
|
+
|
79
|
+
} else {
|
80
|
+
$(".feature,.scenario").each(function(feature){
|
81
|
+
this.style.display = "block";
|
82
|
+
});
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|