repla 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/lib/applescript/{load_html.scpt → load.scpt} +0 -0
  3. data/lib/applescript/{load_html_with_base_url.scpt → load_with_root_access_directory.scpt} +0 -0
  4. data/lib/repla/dependencies/html/index.html +25 -0
  5. data/lib/repla/dependencies/lib/view.rb +5 -5
  6. data/lib/repla/dependencies.rb +1 -2
  7. data/lib/repla/lib/constants.rb +0 -2
  8. data/lib/repla/lib/module.rb +1 -24
  9. data/lib/repla/lib/view/javascript.rb +7 -1
  10. data/lib/repla/lib/view/resources.rb +0 -38
  11. data/lib/repla/lib/view.rb +0 -1
  12. data/lib/repla/lib/window.rb +10 -15
  13. data/lib/repla/logger/test/Rakefile +7 -9
  14. data/lib/repla/logger/test/lib/test_setup.rb +10 -0
  15. data/lib/repla/logger/test/lib/test_view_helper.rb +1 -1
  16. data/lib/repla/logger/test/run_tests.sh +3 -1
  17. data/lib/repla/logger/test/tc_logger.rb +18 -21
  18. data/lib/repla/logger.rb +1 -2
  19. data/lib/repla/repl/html/index.html +22 -0
  20. data/lib/repla/repl/lib/view.rb +5 -50
  21. data/lib/repla/repl.rb +1 -2
  22. data/lib/repla/resources/css/raster.css +131 -0
  23. data/lib/repla/resources/js/bullets/Gruntfile.js +30 -0
  24. data/lib/repla/resources/js/bullets/README.md +3 -0
  25. data/lib/repla/resources/js/bullets/bullets.js +82 -0
  26. data/lib/repla/resources/js/bullets/example/css/bullets.css +6 -0
  27. data/lib/repla/resources/js/bullets/example/css/raster.css +131 -0
  28. data/lib/repla/resources/js/bullets/example/css/style.css +7 -0
  29. data/lib/repla/resources/js/bullets/example/index.html +137 -0
  30. data/lib/repla/resources/js/bullets/example/jade/content.jade +10 -0
  31. data/lib/repla/resources/js/bullets/example/jade/css.jade +3 -0
  32. data/lib/repla/resources/js/bullets/example/jade/index.jade +10 -0
  33. data/lib/repla/resources/js/bullets/example/jade/javascript.jade +5 -0
  34. data/lib/repla/resources/js/bullets/example/js/handlebars.js +2278 -0
  35. data/lib/repla/resources/js/bullets/example/js/jquery.js +9789 -0
  36. data/lib/repla/resources/js/bullets/example/js/mousetrap.js +910 -0
  37. data/lib/repla/resources/js/bullets/example/js/mousetrap_config.js +14 -0
  38. data/lib/repla/resources/js/bullets/example/js/zepto.js +1565 -0
  39. data/lib/repla/resources/js/bullets/package.json +28 -0
  40. data/lib/repla/resources/js/bullets/test/lib/css/mocha.css +270 -0
  41. data/lib/repla/resources/js/bullets/test/lib/index.html +153 -0
  42. data/lib/repla/resources/js/bullets/test/lib/jade/index.jade +13 -0
  43. data/lib/repla/resources/js/bullets/test/lib/jade/mocha.html +15 -0
  44. data/lib/repla/resources/js/bullets/test/lib/js/chai.js +4613 -0
  45. data/lib/repla/resources/js/bullets/test/lib/js/mocha.js +5726 -0
  46. data/lib/repla/resources/js/bullets/test/lib/js/test_helper.js +26 -0
  47. data/lib/repla/resources/js/bullets/test/run_tests.rb +7 -0
  48. data/lib/repla/resources/js/bullets/test/test.js +131 -0
  49. data/lib/repla/resources/js/handlebars.js +2278 -0
  50. data/lib/repla/resources/js/mousetrap.js +910 -0
  51. data/lib/repla/resources/js/zepto.js +1565 -0
  52. data/lib/repla/test/applescript/cancel_dialog.applescript +2 -0
  53. data/lib/repla/test/applescript/confirm_dialog.applescript +2 -0
  54. data/lib/repla/test/applescript/is_running.applescript +5 -0
  55. data/lib/repla/test/applescript/quit.applescript +3 -0
  56. data/lib/repla/test/applescript/set_window_bounds.applescript +23 -0
  57. data/lib/repla/test/applescript/switch_windows.applescript +2 -0
  58. data/lib/repla/test/applescript/window_bounds.applescript +20 -0
  59. data/lib/repla/test/applescript/window_id.applescript +7 -0
  60. data/lib/repla/test/bundles/Cat.wcplugin/Contents/Info.plist +14 -0
  61. data/lib/repla/test/bundles/Cat.wcplugin/Contents/Resources/cat.sh +3 -0
  62. data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Info.plist +14 -0
  63. data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Resources/hello_world.rb +3 -0
  64. data/lib/repla/test/bundles/Invalid.wcplugin/Contents/Info.plist +16 -0
  65. data/lib/repla/test/bundles/Print.wcplugin/Contents/Info.plist +16 -0
  66. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/css/style.css +7 -0
  67. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/index.html +24 -0
  68. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/js/wcprint.js +8 -0
  69. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb +18 -0
  70. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb +13 -0
  71. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/print.rb +10 -0
  72. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Info.plist +14 -0
  73. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/constants.rb +1 -0
  74. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/test_environment.rb +35 -0
  75. data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Info.plist +16 -0
  76. data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Resources/test_log.rb +13 -0
  77. data/lib/repla/test/html/index.html +36 -0
  78. data/lib/repla/test/html/indexjquery.html +37 -0
  79. data/lib/repla/test/html/js/zepto.js +1565 -0
  80. data/lib/repla/test/js/firstcode.js +3 -0
  81. data/lib/repla/test/js/lastcode.js +3 -0
  82. data/lib/repla/test/js/nodom.js +5 -0
  83. data/lib/repla/test/js/text.js +1 -0
  84. data/lib/repla/test/js/textjquery.js +1 -0
  85. data/lib/repla/test/js/title.js +1 -0
  86. data/lib/repla/test/lib/helper.rb +121 -0
  87. data/lib/repla/test.rb +51 -0
  88. data/lib/repla.rb +6 -6
  89. metadata +78 -14
  90. data/lib/repla/dependencies/views/view.html.erb +0 -25
  91. data/lib/repla/extension_constants.rb +0 -1
  92. data/lib/repla/lib/view/erb.rb +0 -17
  93. data/lib/repla/logger/test/lib/test_constants.rb +0 -8
  94. data/lib/repla/repl/view/view.html.erb +0 -12
  95. /data/lib/repla/dependencies/{css → html/css}/style.css +0 -0
  96. /data/lib/repla/dependencies/{js → html/js}/wcdependencies.js +0 -0
  97. /data/lib/repla/repl/{css → html/css}/style.css +0 -0
  98. /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,7 @@
1
+ #!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
2
+
3
+ require 'Shellwords'
4
+
5
+ HTML_FILE = File.join(File.dirname(__FILE__), "lib/index.html")
6
+
7
+ exec("mocha-phantomjs #{Shellwords.escape(HTML_FILE)}")
@@ -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
+ });