slideit 0.1.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 (115) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +5 -0
  4. data/CODE_OF_CONDUCT.md +49 -0
  5. data/Gemfile +4 -0
  6. data/README.md +38 -0
  7. data/Rakefile +10 -0
  8. data/bin/slideit +34 -0
  9. data/lib/slideit/version.rb +3 -0
  10. data/lib/slideit.rb +110 -0
  11. data/res/reveal.js-3.3.0/.gitignore +13 -0
  12. data/res/reveal.js-3.3.0/.travis.yml +5 -0
  13. data/res/reveal.js-3.3.0/CONTRIBUTING.md +23 -0
  14. data/res/reveal.js-3.3.0/Gruntfile.js +176 -0
  15. data/res/reveal.js-3.3.0/LICENSE +19 -0
  16. data/res/reveal.js-3.3.0/README.md +1104 -0
  17. data/res/reveal.js-3.3.0/bower.json +27 -0
  18. data/res/reveal.js-3.3.0/css/print/paper.css +202 -0
  19. data/res/reveal.js-3.3.0/css/print/pdf.css +160 -0
  20. data/res/reveal.js-3.3.0/css/reveal.css +1331 -0
  21. data/res/reveal.js-3.3.0/css/reveal.scss +1411 -0
  22. data/res/reveal.js-3.3.0/css/theme/README.md +21 -0
  23. data/res/reveal.js-3.3.0/css/theme/beige.css +291 -0
  24. data/res/reveal.js-3.3.0/css/theme/black.css +287 -0
  25. data/res/reveal.js-3.3.0/css/theme/blood.css +310 -0
  26. data/res/reveal.js-3.3.0/css/theme/league.css +293 -0
  27. data/res/reveal.js-3.3.0/css/theme/moon.css +291 -0
  28. data/res/reveal.js-3.3.0/css/theme/night.css +285 -0
  29. data/res/reveal.js-3.3.0/css/theme/serif.css +287 -0
  30. data/res/reveal.js-3.3.0/css/theme/simple.css +287 -0
  31. data/res/reveal.js-3.3.0/css/theme/sky.css +294 -0
  32. data/res/reveal.js-3.3.0/css/theme/solarized.css +291 -0
  33. data/res/reveal.js-3.3.0/css/theme/source/beige.scss +39 -0
  34. data/res/reveal.js-3.3.0/css/theme/source/black.scss +49 -0
  35. data/res/reveal.js-3.3.0/css/theme/source/blood.scss +79 -0
  36. data/res/reveal.js-3.3.0/css/theme/source/league.scss +34 -0
  37. data/res/reveal.js-3.3.0/css/theme/source/moon.scss +57 -0
  38. data/res/reveal.js-3.3.0/css/theme/source/night.scss +35 -0
  39. data/res/reveal.js-3.3.0/css/theme/source/serif.scss +35 -0
  40. data/res/reveal.js-3.3.0/css/theme/source/simple.scss +38 -0
  41. data/res/reveal.js-3.3.0/css/theme/source/sky.scss +46 -0
  42. data/res/reveal.js-3.3.0/css/theme/source/solarized.scss +63 -0
  43. data/res/reveal.js-3.3.0/css/theme/source/white.scss +49 -0
  44. data/res/reveal.js-3.3.0/css/theme/template/mixins.scss +29 -0
  45. data/res/reveal.js-3.3.0/css/theme/template/settings.scss +43 -0
  46. data/res/reveal.js-3.3.0/css/theme/template/theme.scss +346 -0
  47. data/res/reveal.js-3.3.0/css/theme/white.css +287 -0
  48. data/res/reveal.js-3.3.0/demo.html +410 -0
  49. data/res/reveal.js-3.3.0/index.html +52 -0
  50. data/res/reveal.js-3.3.0/js/reveal.js +4744 -0
  51. data/res/reveal.js-3.3.0/lib/css/zenburn.css +80 -0
  52. data/res/reveal.js-3.3.0/lib/font/league-gothic/LICENSE +2 -0
  53. data/res/reveal.js-3.3.0/lib/font/league-gothic/league-gothic.css +10 -0
  54. data/res/reveal.js-3.3.0/lib/font/league-gothic/league-gothic.eot +0 -0
  55. data/res/reveal.js-3.3.0/lib/font/league-gothic/league-gothic.ttf +0 -0
  56. data/res/reveal.js-3.3.0/lib/font/league-gothic/league-gothic.woff +0 -0
  57. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/LICENSE +45 -0
  58. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
  59. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-italic.ttf +0 -0
  60. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
  61. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
  62. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-regular.ttf +0 -0
  63. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
  64. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
  65. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-semibold.ttf +0 -0
  66. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
  67. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot +0 -0
  68. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf +0 -0
  69. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff +0 -0
  70. data/res/reveal.js-3.3.0/lib/font/source-sans-pro/source-sans-pro.css +39 -0
  71. data/res/reveal.js-3.3.0/lib/js/classList.js +2 -0
  72. data/res/reveal.js-3.3.0/lib/js/head.min.js +9 -0
  73. data/res/reveal.js-3.3.0/lib/js/html5shiv.js +7 -0
  74. data/res/reveal.js-3.3.0/package.json +44 -0
  75. data/res/reveal.js-3.3.0/plugin/highlight/highlight.js +31 -0
  76. data/res/reveal.js-3.3.0/plugin/markdown/example.html +129 -0
  77. data/res/reveal.js-3.3.0/plugin/markdown/example.md +31 -0
  78. data/res/reveal.js-3.3.0/plugin/markdown/markdown.js +405 -0
  79. data/res/reveal.js-3.3.0/plugin/markdown/marked.js +6 -0
  80. data/res/reveal.js-3.3.0/plugin/math/math.js +67 -0
  81. data/res/reveal.js-3.3.0/plugin/multiplex/client.js +13 -0
  82. data/res/reveal.js-3.3.0/plugin/multiplex/index.js +64 -0
  83. data/res/reveal.js-3.3.0/plugin/multiplex/master.js +31 -0
  84. data/res/reveal.js-3.3.0/plugin/multiplex/package.json +19 -0
  85. data/res/reveal.js-3.3.0/plugin/notes/notes.html +414 -0
  86. data/res/reveal.js-3.3.0/plugin/notes/notes.js +136 -0
  87. data/res/reveal.js-3.3.0/plugin/notes-server/client.js +65 -0
  88. data/res/reveal.js-3.3.0/plugin/notes-server/index.js +69 -0
  89. data/res/reveal.js-3.3.0/plugin/notes-server/notes.html +407 -0
  90. data/res/reveal.js-3.3.0/plugin/print-pdf/print-pdf.js +48 -0
  91. data/res/reveal.js-3.3.0/plugin/search/search.js +196 -0
  92. data/res/reveal.js-3.3.0/plugin/zoom-js/zoom.js +278 -0
  93. data/res/reveal.js-3.3.0/simple.html +90 -0
  94. data/res/reveal.js-3.3.0/test/examples/assets/image1.png +0 -0
  95. data/res/reveal.js-3.3.0/test/examples/assets/image2.png +0 -0
  96. data/res/reveal.js-3.3.0/test/examples/barebones.html +41 -0
  97. data/res/reveal.js-3.3.0/test/examples/embedded-media.html +49 -0
  98. data/res/reveal.js-3.3.0/test/examples/math.html +185 -0
  99. data/res/reveal.js-3.3.0/test/examples/slide-backgrounds.html +144 -0
  100. data/res/reveal.js-3.3.0/test/examples/slide-transitions.html +101 -0
  101. data/res/reveal.js-3.3.0/test/qunit-1.12.0.css +244 -0
  102. data/res/reveal.js-3.3.0/test/qunit-1.12.0.js +2212 -0
  103. data/res/reveal.js-3.3.0/test/test-markdown-element-attributes.html +134 -0
  104. data/res/reveal.js-3.3.0/test/test-markdown-element-attributes.js +46 -0
  105. data/res/reveal.js-3.3.0/test/test-markdown-slide-attributes.html +128 -0
  106. data/res/reveal.js-3.3.0/test/test-markdown-slide-attributes.js +47 -0
  107. data/res/reveal.js-3.3.0/test/test-markdown.html +52 -0
  108. data/res/reveal.js-3.3.0/test/test-markdown.js +15 -0
  109. data/res/reveal.js-3.3.0/test/test-pdf.html +83 -0
  110. data/res/reveal.js-3.3.0/test/test-pdf.js +15 -0
  111. data/res/reveal.js-3.3.0/test/test.html +86 -0
  112. data/res/reveal.js-3.3.0/test/test.js +597 -0
  113. data/res/reveal.js-3.3.0/test.md +31 -0
  114. data/slideit.gemspec +25 -0
  115. metadata +199 -0
@@ -0,0 +1,597 @@
1
+
2
+ // These tests expect the DOM to contain a presentation
3
+ // with the following slide structure:
4
+ //
5
+ // 1
6
+ // 2 - Three sub-slides
7
+ // 3 - Three fragment elements
8
+ // 3 - Two fragments with same data-fragment-index
9
+ // 4
10
+
11
+
12
+ Reveal.addEventListener( 'ready', function() {
13
+
14
+ // ---------------------------------------------------------------
15
+ // DOM TESTS
16
+
17
+ QUnit.module( 'DOM' );
18
+
19
+ test( 'Initial slides classes', function() {
20
+ var horizontalSlides = document.querySelectorAll( '.reveal .slides>section' )
21
+
22
+ strictEqual( document.querySelectorAll( '.reveal .slides section.past' ).length, 0, 'no .past slides' );
23
+ strictEqual( document.querySelectorAll( '.reveal .slides section.present' ).length, 1, 'one .present slide' );
24
+ strictEqual( document.querySelectorAll( '.reveal .slides>section.future' ).length, horizontalSlides.length - 1, 'remaining horizontal slides are .future' );
25
+
26
+ strictEqual( document.querySelectorAll( '.reveal .slides section.stack' ).length, 2, 'two .stacks' );
27
+
28
+ ok( document.querySelectorAll( '.reveal .slides section.stack' )[0].querySelectorAll( '.future' ).length > 0, 'vertical slides are given .future' );
29
+ });
30
+
31
+ // ---------------------------------------------------------------
32
+ // API TESTS
33
+
34
+ QUnit.module( 'API' );
35
+
36
+ test( 'Reveal.isReady', function() {
37
+ strictEqual( Reveal.isReady(), true, 'returns true' );
38
+ });
39
+
40
+ test( 'Reveal.isOverview', function() {
41
+ strictEqual( Reveal.isOverview(), false, 'false by default' );
42
+
43
+ Reveal.toggleOverview();
44
+ strictEqual( Reveal.isOverview(), true, 'true after toggling on' );
45
+
46
+ Reveal.toggleOverview();
47
+ strictEqual( Reveal.isOverview(), false, 'false after toggling off' );
48
+ });
49
+
50
+ test( 'Reveal.isPaused', function() {
51
+ strictEqual( Reveal.isPaused(), false, 'false by default' );
52
+
53
+ Reveal.togglePause();
54
+ strictEqual( Reveal.isPaused(), true, 'true after pausing' );
55
+
56
+ Reveal.togglePause();
57
+ strictEqual( Reveal.isPaused(), false, 'false after resuming' );
58
+ });
59
+
60
+ test( 'Reveal.isFirstSlide', function() {
61
+ Reveal.slide( 0, 0 );
62
+ strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
63
+
64
+ Reveal.slide( 1, 0 );
65
+ strictEqual( Reveal.isFirstSlide(), false, 'false after Reveal.slide( 1, 0 )' );
66
+
67
+ Reveal.slide( 0, 0 );
68
+ strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' );
69
+ });
70
+
71
+ test( 'Reveal.isFirstSlide after vertical slide', function() {
72
+ Reveal.slide( 1, 1 );
73
+ Reveal.slide( 0, 0 );
74
+ strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( 0, 0 )' );
75
+ });
76
+
77
+ test( 'Reveal.isLastSlide', function() {
78
+ Reveal.slide( 0, 0 );
79
+ strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
80
+
81
+ var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
82
+
83
+ Reveal.slide( lastSlideIndex, 0 );
84
+ strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( '+ lastSlideIndex +', 0 )' );
85
+
86
+ Reveal.slide( 0, 0 );
87
+ strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' );
88
+ });
89
+
90
+ test( 'Reveal.isLastSlide after vertical slide', function() {
91
+ var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
92
+
93
+ Reveal.slide( 1, 1 );
94
+ Reveal.slide( lastSlideIndex );
95
+ strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' );
96
+ });
97
+
98
+ test( 'Reveal.getTotalSlides', function() {
99
+ strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' );
100
+ });
101
+
102
+ test( 'Reveal.getIndices', function() {
103
+ var indices = Reveal.getIndices();
104
+
105
+ ok( indices.hasOwnProperty( 'h' ), 'h exists' );
106
+ ok( indices.hasOwnProperty( 'v' ), 'v exists' );
107
+ ok( indices.hasOwnProperty( 'f' ), 'f exists' );
108
+
109
+ Reveal.slide( 1, 0 );
110
+ strictEqual( Reveal.getIndices().h, 1, 'h 1' );
111
+ strictEqual( Reveal.getIndices().v, 0, 'v 0' );
112
+
113
+ Reveal.slide( 1, 2 );
114
+ strictEqual( Reveal.getIndices().h, 1, 'h 1' );
115
+ strictEqual( Reveal.getIndices().v, 2, 'v 2' );
116
+
117
+ Reveal.slide( 0, 0 );
118
+ strictEqual( Reveal.getIndices().h, 0, 'h 0' );
119
+ strictEqual( Reveal.getIndices().v, 0, 'v 0' );
120
+ });
121
+
122
+ test( 'Reveal.getSlide', function() {
123
+ equal( Reveal.getSlide( 0 ), document.querySelector( '.reveal .slides>section:first-child' ), 'gets correct first slide' );
124
+ equal( Reveal.getSlide( 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)' ), 'no v index returns stack' );
125
+ equal( Reveal.getSlide( 1, 0 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(1)' ), 'v index 0 returns first vertical child' );
126
+ equal( Reveal.getSlide( 1, 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(2)' ), 'v index 1 returns second vertical child' );
127
+
128
+ strictEqual( Reveal.getSlide( 100 ), undefined, 'undefined when out of horizontal bounds' );
129
+ strictEqual( Reveal.getSlide( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
130
+ });
131
+
132
+ test( 'Reveal.getSlideBackground', function() {
133
+ equal( Reveal.getSlideBackground( 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:first-child' ), 'gets correct first background' );
134
+ equal( Reveal.getSlideBackground( 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2)' ), 'no v index returns stack' );
135
+ equal( Reveal.getSlideBackground( 1, 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(1)' ), 'v index 0 returns first vertical child' );
136
+ equal( Reveal.getSlideBackground( 1, 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(2)' ), 'v index 1 returns second vertical child' );
137
+
138
+ strictEqual( Reveal.getSlideBackground( 100 ), undefined, 'undefined when out of horizontal bounds' );
139
+ strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
140
+ });
141
+
142
+ test( 'Reveal.getSlideNotes', function() {
143
+ Reveal.slide( 0, 0 );
144
+ ok( Reveal.getSlideNotes() === 'speaker notes 1', 'works with <aside class="notes">' );
145
+
146
+ Reveal.slide( 1, 0 );
147
+ ok( Reveal.getSlideNotes() === 'speaker notes 2', 'works with <section data-notes="">' );
148
+ });
149
+
150
+ test( 'Reveal.getPreviousSlide/getCurrentSlide', function() {
151
+ Reveal.slide( 0, 0 );
152
+ Reveal.slide( 1, 0 );
153
+
154
+ var firstSlide = document.querySelector( '.reveal .slides>section:first-child' );
155
+ var secondSlide = document.querySelector( '.reveal .slides>section:nth-child(2)>section' );
156
+
157
+ equal( Reveal.getPreviousSlide(), firstSlide, 'previous is slide #0' );
158
+ equal( Reveal.getCurrentSlide(), secondSlide, 'current is slide #1' );
159
+ });
160
+
161
+ test( 'Reveal.getProgress', function() {
162
+ Reveal.slide( 0, 0 );
163
+ strictEqual( Reveal.getProgress(), 0, 'progress is 0 on first slide' );
164
+
165
+ var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
166
+
167
+ Reveal.slide( lastSlideIndex, 0 );
168
+ strictEqual( Reveal.getProgress(), 1, 'progress is 1 on last slide' );
169
+ });
170
+
171
+ test( 'Reveal.getScale', function() {
172
+ ok( typeof Reveal.getScale() === 'number', 'has scale' );
173
+ });
174
+
175
+ test( 'Reveal.getConfig', function() {
176
+ ok( typeof Reveal.getConfig() === 'object', 'has config' );
177
+ });
178
+
179
+ test( 'Reveal.configure', function() {
180
+ strictEqual( Reveal.getConfig().loop, false, '"loop" is false to start with' );
181
+
182
+ Reveal.configure({ loop: true });
183
+ strictEqual( Reveal.getConfig().loop, true, '"loop" has changed to true' );
184
+
185
+ Reveal.configure({ loop: false, customTestValue: 1 });
186
+ strictEqual( Reveal.getConfig().customTestValue, 1, 'supports custom values' );
187
+ });
188
+
189
+ test( 'Reveal.availableRoutes', function() {
190
+ Reveal.slide( 0, 0 );
191
+ deepEqual( Reveal.availableRoutes(), { left: false, up: false, down: false, right: true }, 'correct for first slide' );
192
+
193
+ Reveal.slide( 1, 0 );
194
+ deepEqual( Reveal.availableRoutes(), { left: true, up: false, down: true, right: true }, 'correct for vertical slide' );
195
+ });
196
+
197
+ test( 'Reveal.next', function() {
198
+ Reveal.slide( 0, 0 );
199
+
200
+ // Step through vertical child slides
201
+ Reveal.next();
202
+ deepEqual( Reveal.getIndices(), { h: 1, v: 0, f: undefined } );
203
+
204
+ Reveal.next();
205
+ deepEqual( Reveal.getIndices(), { h: 1, v: 1, f: undefined } );
206
+
207
+ Reveal.next();
208
+ deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined } );
209
+
210
+ // Step through fragments
211
+ Reveal.next();
212
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 } );
213
+
214
+ Reveal.next();
215
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 } );
216
+
217
+ Reveal.next();
218
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 } );
219
+
220
+ Reveal.next();
221
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 } );
222
+ });
223
+
224
+ test( 'Reveal.next at end', function() {
225
+ Reveal.slide( 3 );
226
+
227
+ // We're at the end, this should have no effect
228
+ Reveal.next();
229
+ deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
230
+
231
+ Reveal.next();
232
+ deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
233
+ });
234
+
235
+
236
+ // ---------------------------------------------------------------
237
+ // FRAGMENT TESTS
238
+
239
+ QUnit.module( 'Fragments' );
240
+
241
+ test( 'Sliding to fragments', function() {
242
+ Reveal.slide( 2, 0, -1 );
243
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 }, 'Reveal.slide( 2, 0, -1 )' );
244
+
245
+ Reveal.slide( 2, 0, 0 );
246
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'Reveal.slide( 2, 0, 0 )' );
247
+
248
+ Reveal.slide( 2, 0, 2 );
249
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'Reveal.slide( 2, 0, 2 )' );
250
+
251
+ Reveal.slide( 2, 0, 1 );
252
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' );
253
+ });
254
+
255
+ test( 'Hiding all fragments', function() {
256
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
257
+
258
+ Reveal.slide( 2, 0, 0 );
259
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 1, 'one fragment visible when index is 0' );
260
+
261
+ Reveal.slide( 2, 0, -1 );
262
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when index is -1' );
263
+ });
264
+
265
+ test( 'Current fragment', function() {
266
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
267
+
268
+ Reveal.slide( 2, 0 );
269
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment at index -1' );
270
+
271
+ Reveal.slide( 2, 0, 0 );
272
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 1, 'one current fragment at index 0' );
273
+
274
+ Reveal.slide( 1, 0, 0 );
275
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to previous slide' );
276
+
277
+ Reveal.slide( 3, 0, 0 );
278
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to next slide' );
279
+ });
280
+
281
+ test( 'Stepping through fragments', function() {
282
+ Reveal.slide( 2, 0, -1 );
283
+
284
+ // forwards:
285
+
286
+ Reveal.next();
287
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'next() goes to next fragment' );
288
+
289
+ Reveal.right();
290
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'right() goes to next fragment' );
291
+
292
+ Reveal.down();
293
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'down() goes to next fragment' );
294
+
295
+ Reveal.down(); // moves to f #3
296
+
297
+ // backwards:
298
+
299
+ Reveal.prev();
300
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'prev() goes to prev fragment' );
301
+
302
+ Reveal.left();
303
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'left() goes to prev fragment' );
304
+
305
+ Reveal.up();
306
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'up() goes to prev fragment' );
307
+ });
308
+
309
+ test( 'Stepping past fragments', function() {
310
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
311
+
312
+ Reveal.slide( 0, 0, 0 );
313
+ equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when on previous slide' );
314
+
315
+ Reveal.slide( 3, 0, 0 );
316
+ equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 3, 'all fragments visible when on future slide' );
317
+ });
318
+
319
+ test( 'Fragment indices', function() {
320
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(2)' );
321
+
322
+ Reveal.slide( 3, 0, 0 );
323
+ equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 2, 'both fragments of same index are shown' );
324
+
325
+ // This slide has three fragments, first one is index 0, second and third have index 1
326
+ Reveal.slide( 2, 2, 0 );
327
+ equal( Reveal.getIndices().f, 0, 'returns correct index for first fragment' );
328
+
329
+ Reveal.slide( 2, 2, 1 );
330
+ equal( Reveal.getIndices().f, 1, 'returns correct index for two fragments with same index' );
331
+ });
332
+
333
+ test( 'Index generation', function() {
334
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
335
+
336
+ // These have no indices defined to start with
337
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
338
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
339
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '2' );
340
+ });
341
+
342
+ test( 'Index normalization', function() {
343
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(3)' );
344
+
345
+ // These start out as 1-4-4 and should normalize to 0-1-1
346
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
347
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
348
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '1' );
349
+ });
350
+
351
+ asyncTest( 'fragmentshown event', function() {
352
+ expect( 2 );
353
+
354
+ var _onEvent = function( event ) {
355
+ ok( true, 'event fired' );
356
+ }
357
+
358
+ Reveal.addEventListener( 'fragmentshown', _onEvent );
359
+
360
+ Reveal.slide( 2, 0 );
361
+ Reveal.slide( 2, 0 ); // should do nothing
362
+ Reveal.slide( 2, 0, 0 ); // should do nothing
363
+ Reveal.next();
364
+ Reveal.next();
365
+ Reveal.prev(); // shouldn't fire fragmentshown
366
+
367
+ start();
368
+
369
+ Reveal.removeEventListener( 'fragmentshown', _onEvent );
370
+ });
371
+
372
+ asyncTest( 'fragmenthidden event', function() {
373
+ expect( 2 );
374
+
375
+ var _onEvent = function( event ) {
376
+ ok( true, 'event fired' );
377
+ }
378
+
379
+ Reveal.addEventListener( 'fragmenthidden', _onEvent );
380
+
381
+ Reveal.slide( 2, 0, 2 );
382
+ Reveal.slide( 2, 0, 2 ); // should do nothing
383
+ Reveal.prev();
384
+ Reveal.prev();
385
+ Reveal.next(); // shouldn't fire fragmenthidden
386
+
387
+ start();
388
+
389
+ Reveal.removeEventListener( 'fragmenthidden', _onEvent );
390
+ });
391
+
392
+
393
+ // ---------------------------------------------------------------
394
+ // AUTO-SLIDE TESTS
395
+
396
+ QUnit.module( 'Auto Sliding' );
397
+
398
+ test( 'Reveal.isAutoSliding', function() {
399
+ strictEqual( Reveal.isAutoSliding(), false, 'false by default' );
400
+
401
+ Reveal.configure({ autoSlide: 10000 });
402
+ strictEqual( Reveal.isAutoSliding(), true, 'true after starting' );
403
+
404
+ Reveal.configure({ autoSlide: 0 });
405
+ strictEqual( Reveal.isAutoSliding(), false, 'false after setting to 0' );
406
+ });
407
+
408
+ test( 'Reveal.toggleAutoSlide', function() {
409
+ Reveal.configure({ autoSlide: 10000 });
410
+
411
+ Reveal.toggleAutoSlide();
412
+ strictEqual( Reveal.isAutoSliding(), false, 'false after first toggle' );
413
+ Reveal.toggleAutoSlide();
414
+ strictEqual( Reveal.isAutoSliding(), true, 'true after second toggle' );
415
+
416
+ Reveal.configure({ autoSlide: 0 });
417
+ });
418
+
419
+ asyncTest( 'autoslidepaused', function() {
420
+ expect( 1 );
421
+
422
+ var _onEvent = function( event ) {
423
+ ok( true, 'event fired' );
424
+ }
425
+
426
+ Reveal.addEventListener( 'autoslidepaused', _onEvent );
427
+ Reveal.configure({ autoSlide: 10000 });
428
+ Reveal.toggleAutoSlide();
429
+
430
+ start();
431
+
432
+ // cleanup
433
+ Reveal.configure({ autoSlide: 0 });
434
+ Reveal.removeEventListener( 'autoslidepaused', _onEvent );
435
+ });
436
+
437
+ asyncTest( 'autoslideresumed', function() {
438
+ expect( 1 );
439
+
440
+ var _onEvent = function( event ) {
441
+ ok( true, 'event fired' );
442
+ }
443
+
444
+ Reveal.addEventListener( 'autoslideresumed', _onEvent );
445
+ Reveal.configure({ autoSlide: 10000 });
446
+ Reveal.toggleAutoSlide();
447
+ Reveal.toggleAutoSlide();
448
+
449
+ start();
450
+
451
+ // cleanup
452
+ Reveal.configure({ autoSlide: 0 });
453
+ Reveal.removeEventListener( 'autoslideresumed', _onEvent );
454
+ });
455
+
456
+
457
+ // ---------------------------------------------------------------
458
+ // CONFIGURATION VALUES
459
+
460
+ QUnit.module( 'Configuration' );
461
+
462
+ test( 'Controls', function() {
463
+ var controlsElement = document.querySelector( '.reveal>.controls' );
464
+
465
+ Reveal.configure({ controls: false });
466
+ equal( controlsElement.style.display, 'none', 'controls are hidden' );
467
+
468
+ Reveal.configure({ controls: true });
469
+ equal( controlsElement.style.display, 'block', 'controls are visible' );
470
+ });
471
+
472
+ test( 'Progress', function() {
473
+ var progressElement = document.querySelector( '.reveal>.progress' );
474
+
475
+ Reveal.configure({ progress: false });
476
+ equal( progressElement.style.display, 'none', 'progress are hidden' );
477
+
478
+ Reveal.configure({ progress: true });
479
+ equal( progressElement.style.display, 'block', 'progress are visible' );
480
+ });
481
+
482
+ test( 'Loop', function() {
483
+ Reveal.configure({ loop: true });
484
+
485
+ Reveal.slide( 0, 0 );
486
+
487
+ Reveal.left();
488
+ notEqual( Reveal.getIndices().h, 0, 'looped from start to end' );
489
+
490
+ Reveal.right();
491
+ equal( Reveal.getIndices().h, 0, 'looped from end to start' );
492
+
493
+ Reveal.configure({ loop: false });
494
+ });
495
+
496
+
497
+ // ---------------------------------------------------------------
498
+ // LAZY-LOADING TESTS
499
+
500
+ QUnit.module( 'Lazy-Loading' );
501
+
502
+ test( 'img with data-src', function() {
503
+ strictEqual( document.querySelectorAll( '.reveal section img[src]' ).length, 1, 'Image source has been set' );
504
+ });
505
+
506
+ test( 'video with data-src', function() {
507
+ strictEqual( document.querySelectorAll( '.reveal section video[src]' ).length, 1, 'Video source has been set' );
508
+ });
509
+
510
+ test( 'audio with data-src', function() {
511
+ strictEqual( document.querySelectorAll( '.reveal section audio[src]' ).length, 1, 'Audio source has been set' );
512
+ });
513
+
514
+ test( 'iframe with data-src', function() {
515
+ Reveal.slide( 0, 0 );
516
+ strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' );
517
+ Reveal.slide( 2, 1 );
518
+ strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 1, 'Iframe source is set' );
519
+ Reveal.slide( 2, 2 );
520
+ strictEqual( document.querySelectorAll( '.reveal section iframe[src]' ).length, 0, 'Iframe source is not set' );
521
+ });
522
+
523
+ test( 'background images', function() {
524
+ var imageSource1 = Reveal.getSlide( 0 ).getAttribute( 'data-background-image' );
525
+ var imageSource2 = Reveal.getSlide( 1, 0 ).getAttribute( 'data-background' );
526
+
527
+ // check that the images are applied to the background elements
528
+ ok( Reveal.getSlideBackground( 0 ).style.backgroundImage.indexOf( imageSource1 ) !== -1, 'data-background-image worked' );
529
+ ok( Reveal.getSlideBackground( 1, 0 ).style.backgroundImage.indexOf( imageSource2 ) !== -1, 'data-background worked' );
530
+ });
531
+
532
+
533
+ // ---------------------------------------------------------------
534
+ // EVENT TESTS
535
+
536
+ QUnit.module( 'Events' );
537
+
538
+ asyncTest( 'slidechanged', function() {
539
+ expect( 3 );
540
+
541
+ var _onEvent = function( event ) {
542
+ ok( true, 'event fired' );
543
+ }
544
+
545
+ Reveal.addEventListener( 'slidechanged', _onEvent );
546
+
547
+ Reveal.slide( 1, 0 ); // should trigger
548
+ Reveal.slide( 1, 0 ); // should do nothing
549
+ Reveal.next(); // should trigger
550
+ Reveal.slide( 3, 0 ); // should trigger
551
+ Reveal.next(); // should do nothing
552
+
553
+ start();
554
+
555
+ Reveal.removeEventListener( 'slidechanged', _onEvent );
556
+
557
+ });
558
+
559
+ asyncTest( 'paused', function() {
560
+ expect( 1 );
561
+
562
+ var _onEvent = function( event ) {
563
+ ok( true, 'event fired' );
564
+ }
565
+
566
+ Reveal.addEventListener( 'paused', _onEvent );
567
+
568
+ Reveal.togglePause();
569
+ Reveal.togglePause();
570
+
571
+ start();
572
+
573
+ Reveal.removeEventListener( 'paused', _onEvent );
574
+ });
575
+
576
+ asyncTest( 'resumed', function() {
577
+ expect( 1 );
578
+
579
+ var _onEvent = function( event ) {
580
+ ok( true, 'event fired' );
581
+ }
582
+
583
+ Reveal.addEventListener( 'resumed', _onEvent );
584
+
585
+ Reveal.togglePause();
586
+ Reveal.togglePause();
587
+
588
+ start();
589
+
590
+ Reveal.removeEventListener( 'resumed', _onEvent );
591
+ });
592
+
593
+
594
+ } );
595
+
596
+ Reveal.initialize();
597
+
@@ -0,0 +1,31 @@
1
+ # Markdown Demo
2
+
3
+
4
+
5
+ ## External 1.1
6
+
7
+ Content 1.1
8
+
9
+ Note: This will only appear in the speaker notes window.
10
+
11
+
12
+ ## External 1.2
13
+
14
+ Content 1.2
15
+
16
+
17
+
18
+ ## External 2
19
+
20
+ Content 2.1
21
+
22
+
23
+
24
+ ## External 3.1
25
+
26
+ Content 3.1
27
+
28
+
29
+ ## External 3.2
30
+
31
+ Content 3.2
data/slideit.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'slideit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "slideit"
8
+ spec.version = Slideit::VERSION
9
+ spec.authors = ["vincent"]
10
+ spec.email = ["xiewenwei@gmail.com"]
11
+
12
+ spec.summary = %q{Display markdown slides using RevealJS HTML.}
13
+ spec.description = %q{Display markdown slides using RevealJS HTML.}
14
+ spec.homepage = "http://github.com/xiewenwie/slideit."
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.bindir = "bin"
19
+ spec.executables = ["slideit"]
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ end