repla 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/applescript/{load_html.scpt → load.scpt} +0 -0
- data/lib/applescript/{load_html_with_base_url.scpt → load_with_root_access_directory.scpt} +0 -0
- data/lib/repla/dependencies/html/index.html +25 -0
- data/lib/repla/dependencies/lib/view.rb +5 -5
- data/lib/repla/dependencies.rb +1 -2
- data/lib/repla/lib/constants.rb +0 -2
- data/lib/repla/lib/module.rb +1 -24
- data/lib/repla/lib/view/javascript.rb +7 -1
- data/lib/repla/lib/view/resources.rb +0 -38
- data/lib/repla/lib/view.rb +0 -1
- data/lib/repla/lib/window.rb +10 -15
- data/lib/repla/logger/test/Rakefile +7 -9
- data/lib/repla/logger/test/lib/test_setup.rb +10 -0
- data/lib/repla/logger/test/lib/test_view_helper.rb +1 -1
- data/lib/repla/logger/test/run_tests.sh +3 -1
- data/lib/repla/logger/test/tc_logger.rb +18 -21
- data/lib/repla/logger.rb +1 -2
- data/lib/repla/repl/html/index.html +22 -0
- data/lib/repla/repl/lib/view.rb +5 -50
- data/lib/repla/repl.rb +1 -2
- data/lib/repla/resources/css/raster.css +131 -0
- data/lib/repla/resources/js/bullets/Gruntfile.js +30 -0
- data/lib/repla/resources/js/bullets/README.md +3 -0
- data/lib/repla/resources/js/bullets/bullets.js +82 -0
- data/lib/repla/resources/js/bullets/example/css/bullets.css +6 -0
- data/lib/repla/resources/js/bullets/example/css/raster.css +131 -0
- data/lib/repla/resources/js/bullets/example/css/style.css +7 -0
- data/lib/repla/resources/js/bullets/example/index.html +137 -0
- data/lib/repla/resources/js/bullets/example/jade/content.jade +10 -0
- data/lib/repla/resources/js/bullets/example/jade/css.jade +3 -0
- data/lib/repla/resources/js/bullets/example/jade/index.jade +10 -0
- data/lib/repla/resources/js/bullets/example/jade/javascript.jade +5 -0
- data/lib/repla/resources/js/bullets/example/js/handlebars.js +2278 -0
- data/lib/repla/resources/js/bullets/example/js/jquery.js +9789 -0
- data/lib/repla/resources/js/bullets/example/js/mousetrap.js +910 -0
- data/lib/repla/resources/js/bullets/example/js/mousetrap_config.js +14 -0
- data/lib/repla/resources/js/bullets/example/js/zepto.js +1565 -0
- data/lib/repla/resources/js/bullets/package.json +28 -0
- data/lib/repla/resources/js/bullets/test/lib/css/mocha.css +270 -0
- data/lib/repla/resources/js/bullets/test/lib/index.html +153 -0
- data/lib/repla/resources/js/bullets/test/lib/jade/index.jade +13 -0
- data/lib/repla/resources/js/bullets/test/lib/jade/mocha.html +15 -0
- data/lib/repla/resources/js/bullets/test/lib/js/chai.js +4613 -0
- data/lib/repla/resources/js/bullets/test/lib/js/mocha.js +5726 -0
- data/lib/repla/resources/js/bullets/test/lib/js/test_helper.js +26 -0
- data/lib/repla/resources/js/bullets/test/run_tests.rb +7 -0
- data/lib/repla/resources/js/bullets/test/test.js +131 -0
- data/lib/repla/resources/js/handlebars.js +2278 -0
- data/lib/repla/resources/js/mousetrap.js +910 -0
- data/lib/repla/resources/js/zepto.js +1565 -0
- data/lib/repla/test/applescript/cancel_dialog.applescript +2 -0
- data/lib/repla/test/applescript/confirm_dialog.applescript +2 -0
- data/lib/repla/test/applescript/is_running.applescript +5 -0
- data/lib/repla/test/applescript/quit.applescript +3 -0
- data/lib/repla/test/applescript/set_window_bounds.applescript +23 -0
- data/lib/repla/test/applescript/switch_windows.applescript +2 -0
- data/lib/repla/test/applescript/window_bounds.applescript +20 -0
- data/lib/repla/test/applescript/window_id.applescript +7 -0
- data/lib/repla/test/bundles/Cat.wcplugin/Contents/Info.plist +14 -0
- data/lib/repla/test/bundles/Cat.wcplugin/Contents/Resources/cat.sh +3 -0
- data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Info.plist +14 -0
- data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Resources/hello_world.rb +3 -0
- data/lib/repla/test/bundles/Invalid.wcplugin/Contents/Info.plist +16 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Info.plist +16 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/css/style.css +7 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/index.html +24 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/js/wcprint.js +8 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb +18 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb +13 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/print.rb +10 -0
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Info.plist +14 -0
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/constants.rb +1 -0
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/test_environment.rb +35 -0
- data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Info.plist +16 -0
- data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Resources/test_log.rb +13 -0
- data/lib/repla/test/html/index.html +36 -0
- data/lib/repla/test/html/indexjquery.html +37 -0
- data/lib/repla/test/html/js/zepto.js +1565 -0
- data/lib/repla/test/js/firstcode.js +3 -0
- data/lib/repla/test/js/lastcode.js +3 -0
- data/lib/repla/test/js/nodom.js +5 -0
- data/lib/repla/test/js/text.js +1 -0
- data/lib/repla/test/js/textjquery.js +1 -0
- data/lib/repla/test/js/title.js +1 -0
- data/lib/repla/test/lib/helper.rb +121 -0
- data/lib/repla/test.rb +51 -0
- data/lib/repla.rb +6 -6
- metadata +78 -14
- data/lib/repla/dependencies/views/view.html.erb +0 -25
- data/lib/repla/extension_constants.rb +0 -1
- data/lib/repla/lib/view/erb.rb +0 -17
- data/lib/repla/logger/test/lib/test_constants.rb +0 -8
- data/lib/repla/repl/view/view.html.erb +0 -12
- /data/lib/repla/dependencies/{css → html/css}/style.css +0 -0
- /data/lib/repla/dependencies/{js → html/js}/wcdependencies.js +0 -0
- /data/lib/repla/repl/{css → html/css}/style.css +0 -0
- /data/lib/repla/repl/{js → html/js}/wcrepl.js +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
var testhelper = {
|
2
|
+
testSelection: function() {
|
3
|
+
Bullets.selection.length.should.equal(1);
|
4
|
+
var testSelection = document.activeElement;
|
5
|
+
var selection = Bullets.selection[0];
|
6
|
+
selection.should.equal(testSelection);
|
7
|
+
selection.id.should.equal(Bullets.selected)
|
8
|
+
$(Bullets.selectedID).length.should.equal(1);
|
9
|
+
},
|
10
|
+
testNoSelection: function() {
|
11
|
+
Bullets.selection.length.should.equal(0);
|
12
|
+
document.activeElement.should.equal(document.body);
|
13
|
+
$(Bullets.selectedID).length.should.equal(0);
|
14
|
+
},
|
15
|
+
testSelectionMatchesIndex: function(index) {
|
16
|
+
var testText = testhelper.textOf(Bullets.tags, index);
|
17
|
+
var bulletsText = Bullets.selection.text();
|
18
|
+
bulletsText.should.equal(testText);
|
19
|
+
},
|
20
|
+
|
21
|
+
// Private
|
22
|
+
textOf: function(tag, index) {
|
23
|
+
return $(tag).eq(index).text();
|
24
|
+
}
|
25
|
+
|
26
|
+
}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
describe('Bullets', function() {
|
2
|
+
after(function() {
|
3
|
+
Bullets.deselect();
|
4
|
+
});
|
5
|
+
describe('deselect', function() {
|
6
|
+
it('should deselect the selection when it is passed in', function () {
|
7
|
+
Bullets.selectNext();
|
8
|
+
testhelper.testSelection();
|
9
|
+
Bullets.deselect(Bullets.selection);
|
10
|
+
testhelper.testNoSelection();
|
11
|
+
});
|
12
|
+
it('should deselect the selection when nothing is passed in', function () {
|
13
|
+
Bullets.selectNext();
|
14
|
+
testhelper.testSelection();
|
15
|
+
Bullets.deselect();
|
16
|
+
testhelper.testNoSelection();
|
17
|
+
});
|
18
|
+
});
|
19
|
+
|
20
|
+
describe('selectNext', function() {
|
21
|
+
afterEach(function() {
|
22
|
+
Bullets.deselect();
|
23
|
+
});
|
24
|
+
it('should select the first tag when nothing is selected', function() {
|
25
|
+
Bullets.selectNext();
|
26
|
+
testhelper.testSelection();
|
27
|
+
testhelper.testSelectionMatchesIndex(0);
|
28
|
+
});
|
29
|
+
it('should select the next tag after the selection', function() {
|
30
|
+
Bullets.selectNext();
|
31
|
+
Bullets.selectNext();
|
32
|
+
testhelper.testSelection();
|
33
|
+
testhelper.testSelectionMatchesIndex(1);
|
34
|
+
});
|
35
|
+
it('should keep the same selected tag when the last tag is selected', function() {
|
36
|
+
Bullets.selectPrevious();
|
37
|
+
Bullets.selectNext();
|
38
|
+
testhelper.testSelection();
|
39
|
+
testhelper.testSelectionMatchesIndex(-1);
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
describe('selectPrevious', function() {
|
44
|
+
afterEach(function() {
|
45
|
+
Bullets.deselect();
|
46
|
+
});
|
47
|
+
it('should select the last tag when nothing is selected', function() {
|
48
|
+
Bullets.selectPrevious();
|
49
|
+
testhelper.testSelection();
|
50
|
+
testhelper.testSelectionMatchesIndex(-1);
|
51
|
+
});
|
52
|
+
it('should select the previous tag before the selection', function() {
|
53
|
+
Bullets.selectPrevious();
|
54
|
+
Bullets.selectPrevious();
|
55
|
+
testhelper.testSelection();
|
56
|
+
testhelper.testSelectionMatchesIndex(-2);
|
57
|
+
});
|
58
|
+
it('should keep the same selected tag when the first tag is selected', function() {
|
59
|
+
Bullets.selectNext();
|
60
|
+
Bullets.selectPrevious();
|
61
|
+
testhelper.testSelection();
|
62
|
+
testhelper.testSelectionMatchesIndex(0);
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
|
67
|
+
describe('focus and blur', function() {
|
68
|
+
var blurCount;
|
69
|
+
var focusCount;
|
70
|
+
before(function () {
|
71
|
+
$(Bullets.tags).focus(function() {
|
72
|
+
focusCount++;
|
73
|
+
});
|
74
|
+
$(Bullets.tags).blur(function() {
|
75
|
+
blurCount++;
|
76
|
+
});
|
77
|
+
});
|
78
|
+
after(function() {
|
79
|
+
$(Bullets.tags).unbind('blur') ;
|
80
|
+
$(Bullets.tags).unbind('focus') ;
|
81
|
+
});
|
82
|
+
beforeEach(function() {
|
83
|
+
Bullets.deselect();
|
84
|
+
blurCount = 0;
|
85
|
+
focusCount = 0;
|
86
|
+
});
|
87
|
+
it('only focus should run when the next tag is selected', function() {
|
88
|
+
var testFocusCount = 0;
|
89
|
+
var testBlurCount = 0;
|
90
|
+
|
91
|
+
Bullets.selectNext();
|
92
|
+
testFocusCount++;
|
93
|
+
focusCount.should.equal(testFocusCount);
|
94
|
+
blurCount.should.equal(testBlurCount);
|
95
|
+
});
|
96
|
+
it('focus and blur should not run when the selection doen\'t change', function() {
|
97
|
+
var testFocusCount = 0;
|
98
|
+
var testBlurCount = 0;
|
99
|
+
|
100
|
+
Bullets.selectNext();
|
101
|
+
testFocusCount++;
|
102
|
+
focusCount.should.equal(testFocusCount);
|
103
|
+
blurCount.should.equal(testBlurCount);
|
104
|
+
|
105
|
+
Bullets.selectPrevious();
|
106
|
+
focusCount.should.equal(testFocusCount);
|
107
|
+
blurCount.should.equal(testBlurCount);
|
108
|
+
});
|
109
|
+
it('focus and blur should each fire once when the selection changes', function() {
|
110
|
+
var testFocusCount = 0;
|
111
|
+
var testBlurCount = 0;
|
112
|
+
|
113
|
+
Bullets.selectNext();
|
114
|
+
testFocusCount++;
|
115
|
+
focusCount.should.equal(testFocusCount);
|
116
|
+
blurCount.should.equal(testBlurCount);
|
117
|
+
|
118
|
+
Bullets.selectNext();
|
119
|
+
testFocusCount++;
|
120
|
+
testBlurCount++;
|
121
|
+
focusCount.should.equal(testFocusCount);
|
122
|
+
blurCount.should.equal(testBlurCount);
|
123
|
+
|
124
|
+
Bullets.selectNext();
|
125
|
+
testFocusCount++;
|
126
|
+
testBlurCount++;
|
127
|
+
focusCount.should.equal(testFocusCount);
|
128
|
+
blurCount.should.equal(testBlurCount);
|
129
|
+
});
|
130
|
+
});
|
131
|
+
});
|