frank-cucumber 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/frank-skeleton/frank_static_resources.bundle/index.html +29 -34
- data/frank-skeleton/frank_static_resources.bundle/{index.haml → index.html.haml} +28 -29
- data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.coffee +41 -0
- data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.js +46 -0
- data/frank-skeleton/frank_static_resources.bundle/js/controller.coffee +129 -0
- data/frank-skeleton/frank_static_resources.bundle/js/controller.js +142 -0
- data/frank-skeleton/frank_static_resources.bundle/js/details_view.coffee +42 -0
- data/frank-skeleton/frank_static_resources.bundle/js/details_view.js +51 -0
- data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.coffee +64 -0
- data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.js +73 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.coffee +46 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.js +59 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.coffee +167 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.js +198 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.coffee +10 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.js +17 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.coffee +43 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.js +60 -0
- data/frank-skeleton/frank_static_resources.bundle/js/frank.coffee +96 -0
- data/frank-skeleton/frank_static_resources.bundle/js/frank.js +118 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/backbone.js +1431 -0
- data/frank-skeleton/frank_static_resources.bundle/{coffee-script.js → js/lib/coffee-script.js} +0 -0
- data/frank-skeleton/frank_static_resources.bundle/{jquery-ui.min.js → js/lib/jquery-ui.min.js} +0 -0
- data/frank-skeleton/frank_static_resources.bundle/{jquery.min.js → js/lib/jquery.min.js} +0 -0
- data/frank-skeleton/frank_static_resources.bundle/{jquery.treeview.js → js/lib/jquery.treeview.js} +0 -0
- data/frank-skeleton/frank_static_resources.bundle/{json2.js → js/lib/json2.js} +0 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/raphael.js +5815 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/require.js +2053 -0
- data/frank-skeleton/frank_static_resources.bundle/{underscore.js → js/lib/underscore.js} +466 -177
- data/frank-skeleton/frank_static_resources.bundle/js/main.coffee +27 -0
- data/frank-skeleton/frank_static_resources.bundle/js/main.js +29 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.coffee +13 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.js +22 -0
- data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.coffee +15 -0
- data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.js +28 -0
- data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.coffee +59 -0
- data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.js +78 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tree_view.coffee +53 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tree_view.js +64 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_heir_model.coffee +37 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_heir_model.js +48 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_model.coffee +39 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_model.js +62 -0
- data/frank-skeleton/frank_static_resources.bundle/symbiote.css +116 -84
- data/lib/frank-cucumber/frankifier.rb +20 -2
- data/lib/frank-cucumber/version.rb +1 -1
- metadata +70 -38
- data/frank-skeleton/frank_static_resources.bundle/raphael-min.js +0 -7
- data/frank-skeleton/frank_static_resources.bundle/symbiote.js +0 -585
- data/frank-skeleton/frank_static_resources.bundle/symbiote_ui.coffee +0 -39
@@ -3,15 +3,15 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset='utf-8' />
|
5
5
|
<title>Symbiote</title>
|
6
|
-
<script src='jquery.min.js'></script>
|
7
|
-
<script src='jquery-ui.min.js'></script>
|
8
|
-
<script src='
|
9
|
-
<script src='
|
10
|
-
<script src='
|
11
|
-
<script src='
|
12
|
-
<script src='
|
13
|
-
<script src='
|
14
|
-
<script
|
6
|
+
<script src='js/lib/jquery.min.js'></script>
|
7
|
+
<script src='js/lib/jquery-ui.min.js'></script>
|
8
|
+
<script src='js/lib/jquery.treeview.js'></script>
|
9
|
+
<script src='js/lib/coffee-script.js'></script>
|
10
|
+
<script src='js/lib/raphael.js'></script>
|
11
|
+
<script src='js/lib/underscore.js'></script>
|
12
|
+
<script src='js/lib/backbone.js'></script>
|
13
|
+
<script src='js/lib/json2.js'></script>
|
14
|
+
<script data-main='/js/main' src='js/lib/require.js'></script>
|
15
15
|
<link href='reset.css' rel='stylesheet' />
|
16
16
|
<link href='pictos/pictos.css' rel='stylesheet' />
|
17
17
|
<link href='jquery.treeview.css' rel='stylesheet' />
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<body>
|
21
21
|
<header id='header'>
|
22
22
|
<h1>symbiote</h1>
|
23
|
-
<
|
23
|
+
<div class='toast'></div>
|
24
24
|
<div id='refresh'>
|
25
25
|
<button id='dump_button'>
|
26
26
|
<span></span>
|
@@ -29,40 +29,30 @@
|
|
29
29
|
</header>
|
30
30
|
<section class='symbiote_shell'>
|
31
31
|
<article id='selector-test'>
|
32
|
+
<label class='selector-engine-label'>
|
33
|
+
use →
|
34
|
+
</label>
|
35
|
+
<div class='selector-engine dropdown'></div>
|
36
|
+
<label></label>
|
37
|
+
to select views that match →
|
32
38
|
<input id='query' placeholder="Selector label marked:'Search'" />
|
33
|
-
<
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
<button id='touch'>Touch In App</button>
|
38
|
-
</li>
|
39
|
-
<li>
|
40
|
-
<button id='flash'>Flash In App</button>
|
41
|
-
</li>
|
42
|
-
</ul>
|
43
|
-
<div class='drop-indicator'>v</div>
|
44
|
-
</div>
|
45
|
-
<div class='selector_engine'>
|
46
|
-
<input id='selector_engine' value='shelley_compat' />
|
47
|
-
<button id='selector_engine_dropdown'>▼</button>
|
48
|
-
<ul id='selector_engine_options'>
|
49
|
-
<li>shelley_compat</li>
|
50
|
-
<li>uiquery</li>
|
51
|
-
</ul>
|
52
|
-
</div>
|
39
|
+
<label>
|
40
|
+
and then →
|
41
|
+
</label>
|
42
|
+
<div class='action-buttons dropdown'></div>
|
53
43
|
</article>
|
54
44
|
</section>
|
55
45
|
<section class='the-columns'>
|
56
46
|
<div id='list-tabs'>
|
57
47
|
<ul>
|
58
48
|
<li>
|
59
|
-
<a href='#
|
49
|
+
<a href='#dom-dump'>View Heirarchy</a>
|
60
50
|
</li>
|
61
51
|
<li>
|
62
52
|
<a href='#accessible-views-tab'>Accessible Elements</a>
|
63
53
|
</li>
|
64
54
|
</ul>
|
65
|
-
<div id='
|
55
|
+
<div id='dom-dump'>
|
66
56
|
<ul></ul>
|
67
57
|
</div>
|
68
58
|
<div id='accessible-views-tab'>
|
@@ -76,7 +66,7 @@
|
|
76
66
|
<div id='inspect-tabs'>
|
77
67
|
<ul>
|
78
68
|
<li>
|
79
|
-
<a href='#
|
69
|
+
<a href='#dom-detail'>View Properties</a>
|
80
70
|
</li>
|
81
71
|
<li>
|
82
72
|
<a href='#ui-locator'>View Locator</a>
|
@@ -89,10 +79,15 @@
|
|
89
79
|
<span>Y</span>
|
90
80
|
</button>
|
91
81
|
</div>
|
82
|
+
<div id='asploder'>
|
83
|
+
<button>
|
84
|
+
Asplode
|
85
|
+
</button>
|
86
|
+
</div>
|
92
87
|
<button id='ui-locator-rotator'>1</button>
|
93
88
|
<div id='ui-locator-view'></div>
|
94
89
|
</div>
|
95
|
-
<div id='
|
90
|
+
<div id='dom-detail'>
|
96
91
|
<p>Click an element in the view heirarchy on the right to see details of that element here.</p>
|
97
92
|
</div>
|
98
93
|
</div>
|
@@ -4,15 +4,17 @@
|
|
4
4
|
%meta(charset="utf-8")
|
5
5
|
%title Symbiote
|
6
6
|
|
7
|
-
%script(src="jquery.min.js")
|
8
|
-
%script(src="jquery-ui.min.js")
|
9
|
-
%script(src="
|
10
|
-
%script(src="
|
11
|
-
%script(src="
|
12
|
-
%script(src="
|
13
|
-
%script(src="
|
14
|
-
%script(src="
|
15
|
-
|
7
|
+
%script(src="js/lib/jquery.min.js")
|
8
|
+
%script(src="js/lib/jquery-ui.min.js")
|
9
|
+
%script(src="js/lib/jquery.treeview.js")
|
10
|
+
%script(src="js/lib/coffee-script.js")
|
11
|
+
%script(src="js/lib/raphael.js")
|
12
|
+
%script(src="js/lib/underscore.js")
|
13
|
+
%script(src="js/lib/backbone.js")
|
14
|
+
%script(src="js/lib/json2.js")
|
15
|
+
|
16
|
+
%script(data-main="/js/main" src="js/lib/require.js")
|
17
|
+
|
16
18
|
%link(href="reset.css" rel="stylesheet")
|
17
19
|
%link(href="pictos/pictos.css" rel="stylesheet")
|
18
20
|
%link(href="jquery.treeview.css" rel="stylesheet")
|
@@ -21,39 +23,33 @@
|
|
21
23
|
%body
|
22
24
|
%header#header
|
23
25
|
%h1 symbiote
|
24
|
-
|
26
|
+
.toast
|
25
27
|
#refresh
|
26
28
|
%button#dump_button
|
27
29
|
%span
|
28
30
|
|
29
31
|
%section.symbiote_shell
|
30
32
|
%article#selector-test
|
31
|
-
%
|
32
|
-
|
33
|
-
|
34
|
-
%ul.extra-actions
|
35
|
-
%li
|
36
|
-
%button#touch Touch In App
|
37
|
-
%li
|
38
|
-
%button#flash Flash In App
|
39
|
-
%div.drop-indicator v
|
40
|
-
.selector_engine
|
41
|
-
%input#selector_engine(value="shelley_compat")
|
42
|
-
%button#selector_engine_dropdown ▼
|
43
|
-
%ul#selector_engine_options
|
44
|
-
%li shelley_compat
|
45
|
-
%li uiquery
|
33
|
+
%label.selector-engine-label
|
34
|
+
use →
|
35
|
+
.selector-engine.dropdown
|
46
36
|
|
37
|
+
%label
|
38
|
+
to select views that match →
|
39
|
+
%input#query(placeholder="Selector label marked:'Search'")
|
47
40
|
|
41
|
+
%label
|
42
|
+
and then →
|
43
|
+
.action-buttons.dropdown
|
48
44
|
|
49
45
|
%section.the-columns
|
50
46
|
#list-tabs
|
51
47
|
%ul
|
52
48
|
%li
|
53
|
-
%a(href="#
|
49
|
+
%a(href="#dom-dump") View Heirarchy
|
54
50
|
%li
|
55
51
|
%a(href="#accessible-views-tab") Accessible Elements
|
56
|
-
#
|
52
|
+
#dom-dump
|
57
53
|
%ul
|
58
54
|
#accessible-views-tab
|
59
55
|
%div.hints
|
@@ -64,7 +60,7 @@
|
|
64
60
|
#inspect-tabs
|
65
61
|
%ul
|
66
62
|
%li
|
67
|
-
%a(href="#
|
63
|
+
%a(href="#dom-detail") View Properties
|
68
64
|
%li
|
69
65
|
%a(href="#ui-locator") View Locator
|
70
66
|
#ui-locator
|
@@ -72,8 +68,11 @@
|
|
72
68
|
%button
|
73
69
|
Live
|
74
70
|
%span Y
|
71
|
+
#asploder
|
72
|
+
%button
|
73
|
+
Asplode
|
75
74
|
%button#ui-locator-rotator 1
|
76
75
|
#ui-locator-view
|
77
76
|
|
78
|
-
#
|
77
|
+
#dom-detail
|
79
78
|
%p Click an element in the view heirarchy on the right to see details of that element here.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
define ->
|
2
|
+
AccessibleViewItemView = Backbone.View.extend
|
3
|
+
tagName: 'div'
|
4
|
+
|
5
|
+
events:
|
6
|
+
"click": "clicked"
|
7
|
+
"mouseover":"mousedover"
|
8
|
+
"mouseout":"mousedout"
|
9
|
+
|
10
|
+
render: ->
|
11
|
+
@$el.empty().append( """
|
12
|
+
<a href="#" title="#{@model.getShelleySelector()}">
|
13
|
+
<span class="viewClass">#{@model.get('class')}</span>
|
14
|
+
with label
|
15
|
+
"<span class="viewLabel">#{@model.get('accessibilityLabel')}</span>"
|
16
|
+
</a>
|
17
|
+
""")
|
18
|
+
@
|
19
|
+
|
20
|
+
mousedover: -> @model.setActive()
|
21
|
+
mousedout: -> @model.unsetActive()
|
22
|
+
|
23
|
+
clicked: ->
|
24
|
+
@model.trigger( 'accessible-selected', @model )
|
25
|
+
|
26
|
+
|
27
|
+
AccessibleViewsView = Backbone.View.extend
|
28
|
+
el: $('#accessible-views')
|
29
|
+
|
30
|
+
initialize: ->
|
31
|
+
@collection = new Backbone.Collection
|
32
|
+
@collection.on 'reset', _.bind(@render,@)
|
33
|
+
|
34
|
+
|
35
|
+
render: ->
|
36
|
+
@$el.empty()
|
37
|
+
@collection.each (viewModel) =>
|
38
|
+
@$el.append( new AccessibleViewItemView(model:viewModel).render().el )
|
39
|
+
@
|
40
|
+
|
41
|
+
AccessibleViewsView
|
@@ -0,0 +1,46 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
define(function() {
|
4
|
+
var AccessibleViewItemView, AccessibleViewsView;
|
5
|
+
AccessibleViewItemView = Backbone.View.extend({
|
6
|
+
tagName: 'div',
|
7
|
+
events: {
|
8
|
+
"click": "clicked",
|
9
|
+
"mouseover": "mousedover",
|
10
|
+
"mouseout": "mousedout"
|
11
|
+
},
|
12
|
+
render: function() {
|
13
|
+
this.$el.empty().append("<a href=\"#\" title=\"" + (this.model.getShelleySelector()) + "\">\n <span class=\"viewClass\">" + (this.model.get('class')) + "</span>\n with label\n \"<span class=\"viewLabel\">" + (this.model.get('accessibilityLabel')) + "</span>\"\n</a>");
|
14
|
+
return this;
|
15
|
+
},
|
16
|
+
mousedover: function() {
|
17
|
+
return this.model.setActive();
|
18
|
+
},
|
19
|
+
mousedout: function() {
|
20
|
+
return this.model.unsetActive();
|
21
|
+
},
|
22
|
+
clicked: function() {
|
23
|
+
return this.model.trigger('accessible-selected', this.model);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
AccessibleViewsView = Backbone.View.extend({
|
27
|
+
el: $('#accessible-views'),
|
28
|
+
initialize: function() {
|
29
|
+
this.collection = new Backbone.Collection;
|
30
|
+
return this.collection.on('reset', _.bind(this.render, this));
|
31
|
+
},
|
32
|
+
render: function() {
|
33
|
+
var _this = this;
|
34
|
+
this.$el.empty();
|
35
|
+
this.collection.each(function(viewModel) {
|
36
|
+
return _this.$el.append(new AccessibleViewItemView({
|
37
|
+
model: viewModel
|
38
|
+
}).render().el);
|
39
|
+
});
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
});
|
43
|
+
return AccessibleViewsView;
|
44
|
+
});
|
45
|
+
|
46
|
+
}).call(this);
|
@@ -0,0 +1,129 @@
|
|
1
|
+
RELOAD_INTERVAL = 500
|
2
|
+
|
3
|
+
guessAtDeviceFamilyBasedOnViewDump = (viewHeir)->
|
4
|
+
switch viewHeir.accessibilityFrame.size.height
|
5
|
+
when 1024 then 'ipad'
|
6
|
+
when 480 then 'iphone'
|
7
|
+
else
|
8
|
+
console.warn( "couldn't recognize device family based on screen height of " + data.accessibilityFrame.size.height + "px" )
|
9
|
+
'unknown'
|
10
|
+
|
11
|
+
define ['frank'],(frank)->
|
12
|
+
|
13
|
+
createController = ({
|
14
|
+
tabsController,
|
15
|
+
toastController,
|
16
|
+
treeView,
|
17
|
+
ersatzView,
|
18
|
+
detailsView,
|
19
|
+
accessibleViewsView,
|
20
|
+
experimentBarModel,
|
21
|
+
$asplodeButton,
|
22
|
+
$reloadButton,
|
23
|
+
$liveButton})->
|
24
|
+
|
25
|
+
treeView.model.on 'active-view-changed', (viewModel)->
|
26
|
+
|
27
|
+
treeView.model.on 'selected-view-changed', (viewModel)->
|
28
|
+
detailsView.updateModel(viewModel)
|
29
|
+
tabsController.selectViewDetailsTab()
|
30
|
+
|
31
|
+
treeView.model.on 'accessible-view-selected', (viewModel)->
|
32
|
+
viewModel.setActive()
|
33
|
+
experimentBarModel.set( selector: viewModel.getShelleySelector() )
|
34
|
+
|
35
|
+
|
36
|
+
reportActionOutcome = (action,numViews)->
|
37
|
+
message = switch numViews
|
38
|
+
when 0 then "Sorry, no views matched that selector so none were #{action}"
|
39
|
+
when 1 then "1 view was #{action}"
|
40
|
+
else "#{numViews} views were #{action}"
|
41
|
+
toastController.showToastMessage(message)
|
42
|
+
|
43
|
+
validateViewSelector = (selector)->
|
44
|
+
if selector.length == 0
|
45
|
+
toastController.showToastMessage("You haven't provided a view selector. Please enter one below.")
|
46
|
+
false
|
47
|
+
else
|
48
|
+
true
|
49
|
+
|
50
|
+
|
51
|
+
experimentBarModel.on 'flash-clicked', (model)->
|
52
|
+
[selector, selectorEngine] = [model.get('selector'), model.get('selectorEngine')]
|
53
|
+
return unless validateViewSelector(selector)
|
54
|
+
frank.sendFlashCommand(
|
55
|
+
selector,
|
56
|
+
selectorEngine
|
57
|
+
).done (data)->
|
58
|
+
reportActionOutcome( "flashed", data.length )
|
59
|
+
|
60
|
+
experimentBarModel.on 'touch-clicked', (model)->
|
61
|
+
[selector, selectorEngine] = [model.get('selector'), model.get('selectorEngine')]
|
62
|
+
return unless validateViewSelector(selector)
|
63
|
+
|
64
|
+
views = frank.sendTouchCommand(
|
65
|
+
selector,
|
66
|
+
selectorEngine
|
67
|
+
).done (data)->
|
68
|
+
reportActionOutcome( "touched", data.length )
|
69
|
+
|
70
|
+
experimentBarModel.on 'highlight-clicked', (model)->
|
71
|
+
[selector, selectorEngine] = [model.get('selector'), model.get('selectorEngine')]
|
72
|
+
return unless validateViewSelector(selector)
|
73
|
+
|
74
|
+
views = frank.getAccessibilityFramesForViewsMatchingSelector(
|
75
|
+
selector,
|
76
|
+
selectorEngine
|
77
|
+
).done (data)->
|
78
|
+
ersatzView.model.highlightSomeFramesForABit( data )
|
79
|
+
reportActionOutcome( "highlighted", data.length )
|
80
|
+
|
81
|
+
$asplodeButton.on 'click', ->
|
82
|
+
isAsploded = ersatzView.model.toggleAsploded()
|
83
|
+
$asplodeButton.toggleClass( 'down', isAsploded )
|
84
|
+
|
85
|
+
$reloadButton.on 'click', ->
|
86
|
+
reload().done ->
|
87
|
+
toastController.showToastMessage('views reloaded')
|
88
|
+
|
89
|
+
liveTimeout = undefined
|
90
|
+
reloadLoop = ->
|
91
|
+
reload()
|
92
|
+
liveTimeout = window.setTimeout( reloadLoop, RELOAD_INTERVAL )
|
93
|
+
|
94
|
+
$liveButton.on 'click', ->
|
95
|
+
window.clearTimeout(liveTimeout) if liveTimeout?
|
96
|
+
|
97
|
+
if $liveButton.hasClass('down')
|
98
|
+
toastController.showToastMessage('leaving live mode')
|
99
|
+
$liveButton.removeClass('down')
|
100
|
+
else
|
101
|
+
reloadLoop()
|
102
|
+
toastController.showToastMessage('entering live mode')
|
103
|
+
$liveButton.addClass('down')
|
104
|
+
|
105
|
+
reload = ->
|
106
|
+
deferable = $.Deferred()
|
107
|
+
$.when( frank.fetchViewHeirarchy(), frank.fetchOrientation() ).done ([rawHeir,],orientation)->
|
108
|
+
deviceFamily = guessAtDeviceFamilyBasedOnViewDump(rawHeir)
|
109
|
+
|
110
|
+
treeView.model.resetViewHeir(rawHeir)
|
111
|
+
ersatzView.model.resetViews(treeView.model.get('allViews'),deviceFamily,orientation)
|
112
|
+
|
113
|
+
accessibleViews = treeView.model.getAccessibleViews()
|
114
|
+
accessibleViewsView.collection.reset( accessibleViews )
|
115
|
+
|
116
|
+
ersatzView.render()
|
117
|
+
deferable.resolve()
|
118
|
+
|
119
|
+
deferable.promise()
|
120
|
+
|
121
|
+
boot = ->
|
122
|
+
tabsController.selectLocatorTab()
|
123
|
+
reload()
|
124
|
+
|
125
|
+
{
|
126
|
+
boot: boot
|
127
|
+
}
|
128
|
+
|
129
|
+
createController
|
@@ -0,0 +1,142 @@
|
|
1
|
+
(function() {
|
2
|
+
var RELOAD_INTERVAL, guessAtDeviceFamilyBasedOnViewDump;
|
3
|
+
|
4
|
+
RELOAD_INTERVAL = 500;
|
5
|
+
|
6
|
+
guessAtDeviceFamilyBasedOnViewDump = function(viewHeir) {
|
7
|
+
switch (viewHeir.accessibilityFrame.size.height) {
|
8
|
+
case 1024:
|
9
|
+
return 'ipad';
|
10
|
+
case 480:
|
11
|
+
return 'iphone';
|
12
|
+
default:
|
13
|
+
console.warn("couldn't recognize device family based on screen height of " + data.accessibilityFrame.size.height + "px");
|
14
|
+
return 'unknown';
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
define(['frank'], function(frank) {
|
19
|
+
var createController;
|
20
|
+
createController = function(_arg) {
|
21
|
+
var $asplodeButton, $liveButton, $reloadButton, accessibleViewsView, boot, detailsView, ersatzView, experimentBarModel, liveTimeout, reload, reloadLoop, reportActionOutcome, tabsController, toastController, treeView, validateViewSelector;
|
22
|
+
tabsController = _arg.tabsController, toastController = _arg.toastController, treeView = _arg.treeView, ersatzView = _arg.ersatzView, detailsView = _arg.detailsView, accessibleViewsView = _arg.accessibleViewsView, experimentBarModel = _arg.experimentBarModel, $asplodeButton = _arg.$asplodeButton, $reloadButton = _arg.$reloadButton, $liveButton = _arg.$liveButton;
|
23
|
+
treeView.model.on('active-view-changed', function(viewModel) {});
|
24
|
+
treeView.model.on('selected-view-changed', function(viewModel) {
|
25
|
+
detailsView.updateModel(viewModel);
|
26
|
+
return tabsController.selectViewDetailsTab();
|
27
|
+
});
|
28
|
+
treeView.model.on('accessible-view-selected', function(viewModel) {
|
29
|
+
viewModel.setActive();
|
30
|
+
return experimentBarModel.set({
|
31
|
+
selector: viewModel.getShelleySelector()
|
32
|
+
});
|
33
|
+
});
|
34
|
+
reportActionOutcome = function(action, numViews) {
|
35
|
+
var message;
|
36
|
+
message = (function() {
|
37
|
+
switch (numViews) {
|
38
|
+
case 0:
|
39
|
+
return "Sorry, no views matched that selector so none were " + action;
|
40
|
+
case 1:
|
41
|
+
return "1 view was " + action;
|
42
|
+
default:
|
43
|
+
return "" + numViews + " views were " + action;
|
44
|
+
}
|
45
|
+
})();
|
46
|
+
return toastController.showToastMessage(message);
|
47
|
+
};
|
48
|
+
validateViewSelector = function(selector) {
|
49
|
+
if (selector.length === 0) {
|
50
|
+
toastController.showToastMessage("You haven't provided a view selector. Please enter one below.");
|
51
|
+
return false;
|
52
|
+
} else {
|
53
|
+
return true;
|
54
|
+
}
|
55
|
+
};
|
56
|
+
experimentBarModel.on('flash-clicked', function(model) {
|
57
|
+
var selector, selectorEngine, _ref;
|
58
|
+
_ref = [model.get('selector'), model.get('selectorEngine')], selector = _ref[0], selectorEngine = _ref[1];
|
59
|
+
if (!validateViewSelector(selector)) {
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
return frank.sendFlashCommand(selector, selectorEngine).done(function(data) {
|
63
|
+
return reportActionOutcome("flashed", data.length);
|
64
|
+
});
|
65
|
+
});
|
66
|
+
experimentBarModel.on('touch-clicked', function(model) {
|
67
|
+
var selector, selectorEngine, views, _ref;
|
68
|
+
_ref = [model.get('selector'), model.get('selectorEngine')], selector = _ref[0], selectorEngine = _ref[1];
|
69
|
+
if (!validateViewSelector(selector)) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
return views = frank.sendTouchCommand(selector, selectorEngine).done(function(data) {
|
73
|
+
return reportActionOutcome("touched", data.length);
|
74
|
+
});
|
75
|
+
});
|
76
|
+
experimentBarModel.on('highlight-clicked', function(model) {
|
77
|
+
var selector, selectorEngine, views, _ref;
|
78
|
+
_ref = [model.get('selector'), model.get('selectorEngine')], selector = _ref[0], selectorEngine = _ref[1];
|
79
|
+
if (!validateViewSelector(selector)) {
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
return views = frank.getAccessibilityFramesForViewsMatchingSelector(selector, selectorEngine).done(function(data) {
|
83
|
+
ersatzView.model.highlightSomeFramesForABit(data);
|
84
|
+
return reportActionOutcome("highlighted", data.length);
|
85
|
+
});
|
86
|
+
});
|
87
|
+
$asplodeButton.on('click', function() {
|
88
|
+
var isAsploded;
|
89
|
+
isAsploded = ersatzView.model.toggleAsploded();
|
90
|
+
return $asplodeButton.toggleClass('down', isAsploded);
|
91
|
+
});
|
92
|
+
$reloadButton.on('click', function() {
|
93
|
+
return reload().done(function() {
|
94
|
+
return toastController.showToastMessage('views reloaded');
|
95
|
+
});
|
96
|
+
});
|
97
|
+
liveTimeout = void 0;
|
98
|
+
reloadLoop = function() {
|
99
|
+
reload();
|
100
|
+
return liveTimeout = window.setTimeout(reloadLoop, RELOAD_INTERVAL);
|
101
|
+
};
|
102
|
+
$liveButton.on('click', function() {
|
103
|
+
if (liveTimeout != null) {
|
104
|
+
window.clearTimeout(liveTimeout);
|
105
|
+
}
|
106
|
+
if ($liveButton.hasClass('down')) {
|
107
|
+
toastController.showToastMessage('leaving live mode');
|
108
|
+
return $liveButton.removeClass('down');
|
109
|
+
} else {
|
110
|
+
reloadLoop();
|
111
|
+
toastController.showToastMessage('entering live mode');
|
112
|
+
return $liveButton.addClass('down');
|
113
|
+
}
|
114
|
+
});
|
115
|
+
reload = function() {
|
116
|
+
var deferable;
|
117
|
+
deferable = $.Deferred();
|
118
|
+
$.when(frank.fetchViewHeirarchy(), frank.fetchOrientation()).done(function(_arg1, orientation) {
|
119
|
+
var accessibleViews, deviceFamily, rawHeir;
|
120
|
+
rawHeir = _arg1[0];
|
121
|
+
deviceFamily = guessAtDeviceFamilyBasedOnViewDump(rawHeir);
|
122
|
+
treeView.model.resetViewHeir(rawHeir);
|
123
|
+
ersatzView.model.resetViews(treeView.model.get('allViews'), deviceFamily, orientation);
|
124
|
+
accessibleViews = treeView.model.getAccessibleViews();
|
125
|
+
accessibleViewsView.collection.reset(accessibleViews);
|
126
|
+
ersatzView.render();
|
127
|
+
return deferable.resolve();
|
128
|
+
});
|
129
|
+
return deferable.promise();
|
130
|
+
};
|
131
|
+
boot = function() {
|
132
|
+
tabsController.selectLocatorTab();
|
133
|
+
return reload();
|
134
|
+
};
|
135
|
+
return {
|
136
|
+
boot: boot
|
137
|
+
};
|
138
|
+
};
|
139
|
+
return createController;
|
140
|
+
});
|
141
|
+
|
142
|
+
}).call(this);
|