reveal-ck 0.1.2 → 0.1.3

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 (80) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +13 -0
  3. data/bin/reveal-ck +23 -8
  4. data/lib/reveal-ck.rb +6 -0
  5. data/lib/reveal-ck/build_task.rb +14 -0
  6. data/lib/reveal-ck/builder.rb +21 -0
  7. data/lib/reveal-ck/config.rb +43 -0
  8. data/lib/reveal-ck/file_slicer.rb +19 -17
  9. data/lib/reveal-ck/file_splicer.rb +30 -28
  10. data/lib/reveal-ck/file_string_replacer.rb +17 -0
  11. data/lib/reveal-ck/haml_processor.rb +17 -15
  12. data/lib/reveal-ck/presentation_builder.rb +69 -0
  13. data/lib/reveal-ck/slide_builder.rb +66 -0
  14. data/lib/reveal-ck/version.rb +1 -1
  15. data/rakelib/cucumber.rake +14 -1
  16. data/reveal.js/Gruntfile.js +132 -0
  17. data/reveal.js/LICENSE +1 -1
  18. data/reveal.js/README.md +362 -50
  19. data/reveal.js/css/print/paper.css +14 -14
  20. data/reveal.js/css/print/pdf.css +60 -30
  21. data/reveal.js/css/reveal.css +444 -149
  22. data/reveal.js/css/reveal.min.css +2 -2
  23. data/reveal.js/css/theme/README.md +8 -10
  24. data/reveal.js/css/theme/beige.css +24 -45
  25. data/reveal.js/css/theme/default.css +24 -45
  26. data/reveal.js/css/theme/moon.css +142 -0
  27. data/reveal.js/css/theme/night.css +24 -44
  28. data/reveal.js/css/theme/serif.css +27 -45
  29. data/reveal.js/css/theme/simple.css +25 -45
  30. data/reveal.js/css/theme/sky.css +26 -43
  31. data/reveal.js/css/theme/solarized.css +142 -0
  32. data/reveal.js/css/theme/source/beige.scss +2 -2
  33. data/reveal.js/css/theme/source/default.scss +2 -2
  34. data/reveal.js/css/theme/source/moon.scss +68 -0
  35. data/reveal.js/css/theme/source/night.scss +4 -4
  36. data/reveal.js/css/theme/source/serif.scss +8 -6
  37. data/reveal.js/css/theme/source/simple.scss +5 -5
  38. data/reveal.js/css/theme/source/sky.scss +9 -4
  39. data/reveal.js/css/theme/source/solarized.scss +74 -0
  40. data/reveal.js/css/theme/template/settings.scss +2 -2
  41. data/reveal.js/examples/assets/image1.png +0 -0
  42. data/reveal.js/examples/assets/image2.png +0 -0
  43. data/reveal.js/examples/barebones.html +42 -0
  44. data/reveal.js/examples/embedded-media.html +49 -0
  45. data/reveal.js/examples/slide-backgrounds.html +101 -0
  46. data/reveal.js/index.html +63 -56
  47. data/reveal.js/js/reveal.js +997 -216
  48. data/reveal.js/js/reveal.min.js +3 -3
  49. data/reveal.js/package.json +43 -29
  50. data/reveal.js/plugin/highlight/highlight.js +28 -6
  51. data/reveal.js/plugin/markdown/example.html +97 -0
  52. data/reveal.js/plugin/markdown/example.md +29 -0
  53. data/reveal.js/plugin/markdown/markdown.js +164 -11
  54. data/reveal.js/plugin/markdown/marked.js +37 -0
  55. data/reveal.js/plugin/multiplex/client.js +13 -0
  56. data/reveal.js/plugin/multiplex/index.js +56 -0
  57. data/reveal.js/plugin/multiplex/master.js +50 -0
  58. data/reveal.js/plugin/notes-server/index.js +1 -0
  59. data/reveal.js/plugin/notes-server/notes.html +8 -5
  60. data/reveal.js/plugin/notes/notes.html +133 -44
  61. data/reveal.js/plugin/notes/notes.js +3 -1
  62. data/reveal.js/plugin/print-pdf/print-pdf.js +8 -3
  63. data/reveal.js/plugin/remotes/remotes.js +13 -4
  64. data/reveal.js/plugin/search/search.js +196 -0
  65. data/reveal.js/plugin/zoom-js/zoom.js +26 -21
  66. data/spec/data/config/config.toml +6 -0
  67. data/spec/data/string_replacer/after_replace +4 -0
  68. data/spec/data/string_replacer/before_replace +4 -0
  69. data/spec/lib/reveal-ck/config_spec.rb +50 -0
  70. data/spec/lib/reveal-ck/file_slicer_spec.rb +29 -27
  71. data/spec/lib/reveal-ck/file_splicer_spec.rb +28 -26
  72. data/spec/lib/reveal-ck/file_string_replacer_spec.rb +32 -0
  73. data/spec/lib/reveal-ck/haml_processor_spec.rb +28 -26
  74. metadata +82 -27
  75. data/rakelib/presentation.rake +0 -41
  76. data/rakelib/reveal.rake +0 -15
  77. data/reveal.js/css/shaders/tile-flip.fs +0 -64
  78. data/reveal.js/css/shaders/tile-flip.vs +0 -141
  79. data/reveal.js/grunt.js +0 -84
  80. data/reveal.js/plugin/markdown/showdown.js +0 -62
@@ -5,7 +5,9 @@
5
5
  var RevealNotes = (function() {
6
6
 
7
7
  function openNotes() {
8
- var notesPopup = window.open( 'plugin/notes/notes.html', 'reveal.js - Notes', 'width=1120,height=850' );
8
+ var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
9
+ jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
10
+ var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' );
9
11
 
10
12
  // Fires when slide is changed
11
13
  Reveal.addEventListener( 'slidechanged', function( event ) {
@@ -11,8 +11,13 @@
11
11
  var page = new WebPage();
12
12
  var system = require( 'system' );
13
13
 
14
+ page.viewportSize = {
15
+ width: 1024,
16
+ height: 768
17
+ };
18
+
14
19
  page.paperSize = {
15
- format: 'A4',
20
+ format: 'letter',
16
21
  orientation: 'landscape',
17
22
  margin: {
18
23
  left: '0',
@@ -21,7 +26,6 @@ page.paperSize = {
21
26
  bottom: '0'
22
27
  }
23
28
  };
24
- page.zoomFactor = 1.5;
25
29
 
26
30
  var revealFile = system.args[1] || 'index.html?print-pdf';
27
31
  var slideFile = system.args[2] || 'slides.pdf';
@@ -36,4 +40,5 @@ page.open( revealFile, function( status ) {
36
40
  console.log( 'Printed succesfully' );
37
41
  page.render( slideFile );
38
42
  phantom.exit();
39
- } );
43
+ } );
44
+
@@ -13,16 +13,25 @@
13
13
  return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
14
14
  })();
15
15
 
16
- if(!hasTouch){
16
+ /**
17
+ * Detects if notes are enable and the current page is opened inside an /iframe
18
+ * this prevents loading Remotes.io several times
19
+ */
20
+ var remotesAndIsNotes = (function(){
21
+ return !(window.RevealNotes && self == top);
22
+ })();
23
+
24
+ if(!hasTouch && !remotesAndIsNotes){
17
25
  head.ready( 'remotes.ne.min.js', function() {
18
26
  new Remotes("preview")
19
27
  .on("swipe-left", function(e){ Reveal.right(); })
20
28
  .on("swipe-right", function(e){ Reveal.left(); })
21
29
  .on("swipe-up", function(e){ Reveal.down(); })
22
30
  .on("swipe-down", function(e){ Reveal.up(); })
23
- .on("tap", function(e){
24
- Reveal.toggleOverview();
25
- });
31
+ .on("tap", function(e){ Reveal.next(); })
32
+ .on("zoom-out", function(e){ Reveal.toggleOverview(true); })
33
+ .on("zoom-in", function(e){ Reveal.toggleOverview(false); })
34
+ ;
26
35
  } );
27
36
 
28
37
  head.js('https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js');
@@ -0,0 +1,196 @@
1
+ /*
2
+ * Handles finding a text string anywhere in the slides and showing the next occurrence to the user
3
+ * by navigatating to that slide and highlighting it.
4
+ *
5
+ * By Jon Snyder <snyder.jon@gmail.com>, February 2013
6
+ */
7
+
8
+ var RevealSearch = (function() {
9
+
10
+ var matchedSlides;
11
+ var currentMatchedIndex;
12
+ var searchboxDirty;
13
+ var myHilitor;
14
+
15
+ // Original JavaScript code by Chirp Internet: www.chirp.com.au
16
+ // Please acknowledge use of this code by including this header.
17
+ // 2/2013 jon: modified regex to display any match, not restricted to word boundaries.
18
+
19
+ function Hilitor(id, tag)
20
+ {
21
+
22
+ var targetNode = document.getElementById(id) || document.body;
23
+ var hiliteTag = tag || "EM";
24
+ var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM|SPAN)$");
25
+ var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
26
+ var wordColor = [];
27
+ var colorIdx = 0;
28
+ var matchRegex = "";
29
+ var matchingSlides = [];
30
+
31
+ this.setRegex = function(input)
32
+ {
33
+ input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|");
34
+ matchRegex = new RegExp("(" + input + ")","i");
35
+ }
36
+
37
+ this.getRegex = function()
38
+ {
39
+ return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
40
+ }
41
+
42
+ // recursively apply word highlighting
43
+ this.hiliteWords = function(node)
44
+ {
45
+ if(node == undefined || !node) return;
46
+ if(!matchRegex) return;
47
+ if(skipTags.test(node.nodeName)) return;
48
+
49
+ if(node.hasChildNodes()) {
50
+ for(var i=0; i < node.childNodes.length; i++)
51
+ this.hiliteWords(node.childNodes[i]);
52
+ }
53
+ if(node.nodeType == 3) { // NODE_TEXT
54
+ if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
55
+ //find the slide's section element and save it in our list of matching slides
56
+ var secnode = node.parentNode;
57
+ while (secnode.nodeName != 'SECTION') {
58
+ secnode = secnode.parentNode;
59
+ }
60
+
61
+ var slideIndex = Reveal.getIndices(secnode);
62
+ var slidelen = matchingSlides.length;
63
+ var alreadyAdded = false;
64
+ for (var i=0; i < slidelen; i++) {
65
+ if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) {
66
+ alreadyAdded = true;
67
+ }
68
+ }
69
+ if (! alreadyAdded) {
70
+ matchingSlides.push(slideIndex);
71
+ }
72
+
73
+ if(!wordColor[regs[0].toLowerCase()]) {
74
+ wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
75
+ }
76
+
77
+ var match = document.createElement(hiliteTag);
78
+ match.appendChild(document.createTextNode(regs[0]));
79
+ match.style.backgroundColor = wordColor[regs[0].toLowerCase()];
80
+ match.style.fontStyle = "inherit";
81
+ match.style.color = "#000";
82
+
83
+ var after = node.splitText(regs.index);
84
+ after.nodeValue = after.nodeValue.substring(regs[0].length);
85
+ node.parentNode.insertBefore(match, after);
86
+ }
87
+ }
88
+ };
89
+
90
+ // remove highlighting
91
+ this.remove = function()
92
+ {
93
+ var arr = document.getElementsByTagName(hiliteTag);
94
+ while(arr.length && (el = arr[0])) {
95
+ el.parentNode.replaceChild(el.firstChild, el);
96
+ }
97
+ };
98
+
99
+ // start highlighting at target node
100
+ this.apply = function(input)
101
+ {
102
+ if(input == undefined || !input) return;
103
+ this.remove();
104
+ this.setRegex(input);
105
+ this.hiliteWords(targetNode);
106
+ return matchingSlides;
107
+ };
108
+
109
+ }
110
+
111
+ function openSearch() {
112
+ //ensure the search term input dialog is visible and has focus:
113
+ var inputbox = document.getElementById("searchinput");
114
+ inputbox.style.display = "inline";
115
+ inputbox.focus();
116
+ inputbox.select();
117
+ }
118
+
119
+ function toggleSearch() {
120
+ var inputbox = document.getElementById("searchinput");
121
+ if (inputbox.style.display !== "inline") {
122
+ openSearch();
123
+ }
124
+ else {
125
+ inputbox.style.display = "none";
126
+ myHilitor.remove();
127
+ }
128
+ }
129
+
130
+ function doSearch() {
131
+ //if there's been a change in the search term, perform a new search:
132
+ if (searchboxDirty) {
133
+ var searchstring = document.getElementById("searchinput").value;
134
+
135
+ //find the keyword amongst the slides
136
+ myHilitor = new Hilitor("slidecontent");
137
+ matchedSlides = myHilitor.apply(searchstring);
138
+ currentMatchedIndex = 0;
139
+ }
140
+
141
+ //navigate to the next slide that has the keyword, wrapping to the first if necessary
142
+ if (matchedSlides.length && (matchedSlides.length <= currentMatchedIndex)) {
143
+ currentMatchedIndex = 0;
144
+ }
145
+ if (matchedSlides.length > currentMatchedIndex) {
146
+ Reveal.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v);
147
+ currentMatchedIndex++;
148
+ }
149
+ }
150
+
151
+ var dom = {};
152
+ dom.wrapper = document.querySelector( '.reveal' );
153
+
154
+ if( !dom.wrapper.querySelector( '.searchbox' ) ) {
155
+ var searchElement = document.createElement( 'div' );
156
+ searchElement.id = "searchinputdiv";
157
+ searchElement.classList.add( 'searchdiv' );
158
+ searchElement.style.position = 'absolute';
159
+ searchElement.style.top = '10px';
160
+ searchElement.style.left = '10px';
161
+ //embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
162
+ searchElement.innerHTML = '<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>';
163
+ dom.wrapper.appendChild( searchElement );
164
+ }
165
+
166
+ document.getElementById("searchbutton").addEventListener( 'click', function(event) {
167
+ doSearch();
168
+ }, false );
169
+
170
+ document.getElementById("searchinput").addEventListener( 'keyup', function( event ) {
171
+ switch (event.keyCode) {
172
+ case 13:
173
+ event.preventDefault();
174
+ doSearch();
175
+ searchboxDirty = false;
176
+ break;
177
+ default:
178
+ searchboxDirty = true;
179
+ }
180
+ }, false );
181
+
182
+ // Open the search when the 's' key is hit (yes, this conflicts with the notes plugin, disabling for now)
183
+ /*
184
+ document.addEventListener( 'keydown', function( event ) {
185
+ // Disregard the event if the target is editable or a
186
+ // modifier is present
187
+ if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
188
+
189
+ if( event.keyCode === 83 ) {
190
+ event.preventDefault();
191
+ openSearch();
192
+ }
193
+ }, false );
194
+ */
195
+ return { open: openSearch };
196
+ })();
@@ -1,29 +1,34 @@
1
1
  // Custom reveal.js integration
2
2
  (function(){
3
- document.querySelector( '.reveal' ).addEventListener( 'click', function( event ) {
4
- if( event.altKey ) {
3
+ var isEnabled = true;
4
+
5
+ document.querySelector( '.reveal' ).addEventListener( 'mousedown', function( event ) {
6
+ if( event.altKey && isEnabled ) {
5
7
  event.preventDefault();
6
8
  zoom.to({ element: event.target, pan: false });
7
9
  }
8
10
  } );
11
+
12
+ Reveal.addEventListener( 'overviewshown', function() { isEnabled = false; } );
13
+ Reveal.addEventListener( 'overviewhidden', function() { isEnabled = true; } );
9
14
  })();
10
15
 
11
16
  /*!
12
17
  * zoom.js 0.2 (modified version for use with reveal.js)
13
18
  * http://lab.hakim.se/zoom-js
14
19
  * MIT licensed
15
- *
20
+ *
16
21
  * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
17
22
  */
18
23
  var zoom = (function(){
19
24
 
20
25
  // The current zoom level (scale)
21
26
  var level = 1;
22
-
27
+
23
28
  // The current mouse position, used for panning
24
29
  var mouseX = 0,
25
30
  mouseY = 0;
26
-
31
+
27
32
  // Timeout before pan is activated
28
33
  var panEngageTimeout = -1,
29
34
  panUpdateInterval = -1;
@@ -36,7 +41,7 @@ var zoom = (function(){
36
41
  'msTransform' in document.body.style ||
37
42
  'OTransform' in document.body.style ||
38
43
  'transform' in document.body.style;
39
-
44
+
40
45
  if( supportsTransforms ) {
41
46
  // The easing that will be applied when we zoom in/out
42
47
  document.body.style.transition = 'transform 0.8s ease';
@@ -45,7 +50,7 @@ var zoom = (function(){
45
50
  document.body.style.MozTransition = '-moz-transform 0.8s ease';
46
51
  document.body.style.WebkitTransition = '-webkit-transform 0.8s ease';
47
52
  }
48
-
53
+
49
54
  // Zoom out if the user hits escape
50
55
  document.addEventListener( 'keyup', function( event ) {
51
56
  if( level !== 1 && event.keyCode === 27 ) {
@@ -62,21 +67,21 @@ var zoom = (function(){
62
67
  }, false );
63
68
 
64
69
  /**
65
- * Applies the CSS required to zoom in, prioritizes use of CSS3
70
+ * Applies the CSS required to zoom in, prioritizes use of CSS3
66
71
  * transforms but falls back on zoom for IE.
67
- *
68
- * @param {Number} pageOffsetX
69
- * @param {Number} pageOffsetY
70
- * @param {Number} elementOffsetX
71
- * @param {Number} elementOffsetY
72
- * @param {Number} scale
72
+ *
73
+ * @param {Number} pageOffsetX
74
+ * @param {Number} pageOffsetY
75
+ * @param {Number} elementOffsetX
76
+ * @param {Number} elementOffsetY
77
+ * @param {Number} scale
73
78
  */
74
79
  function magnify( pageOffsetX, pageOffsetY, elementOffsetX, elementOffsetY, scale ) {
75
80
 
76
81
  if( supportsTransforms ) {
77
82
  var origin = pageOffsetX +'px '+ pageOffsetY +'px',
78
83
  transform = 'translate('+ -elementOffsetX +'px,'+ -elementOffsetY +'px) scale('+ scale +')';
79
-
84
+
80
85
  document.body.style.transformOrigin = origin;
81
86
  document.body.style.OTransformOrigin = origin;
82
87
  document.body.style.msTransformOrigin = origin;
@@ -121,7 +126,7 @@ var zoom = (function(){
121
126
  }
122
127
 
123
128
  /**
124
- * Pan the document when the mosue cursor approaches the edges
129
+ * Pan the document when the mosue cursor approaches the edges
125
130
  * of the window.
126
131
  */
127
132
  function pan() {
@@ -129,7 +134,7 @@ var zoom = (function(){
129
134
  rangeX = window.innerWidth * range,
130
135
  rangeY = window.innerHeight * range,
131
136
  scrollOffset = getScrollOffset();
132
-
137
+
133
138
  // Up
134
139
  if( mouseY < rangeY ) {
135
140
  window.scroll( scrollOffset.x, scrollOffset.y - ( 1 - ( mouseY / rangeY ) ) * ( 14 / level ) );
@@ -159,7 +164,7 @@ var zoom = (function(){
159
164
  return {
160
165
  /**
161
166
  * Zooms in on either a rectangle or HTML element.
162
- *
167
+ *
163
168
  * @param {Object} options
164
169
  * - element: HTML element to zoom in on
165
170
  * OR
@@ -232,7 +237,7 @@ var zoom = (function(){
232
237
  if( currentOptions && currentOptions.element ) {
233
238
  scrollOffset.x -= ( window.innerWidth - ( currentOptions.width * currentOptions.scale ) ) / 2;
234
239
  }
235
-
240
+
236
241
  magnify( scrollOffset.x, scrollOffset.y, 0, 0, 1 );
237
242
 
238
243
  level = 1;
@@ -241,11 +246,11 @@ var zoom = (function(){
241
246
  // Alias
242
247
  magnify: function( options ) { this.to( options ) },
243
248
  reset: function() { this.out() },
244
-
249
+
245
250
  zoomLevel: function() {
246
251
  return level;
247
252
  }
248
253
  }
249
-
254
+
250
255
  })();
251
256
 
@@ -0,0 +1,6 @@
1
+ title = "The Never Sea Slides"
2
+ author = "Captain Hook"
3
+
4
+ [presentation]
5
+
6
+ theme = "night"
@@ -0,0 +1,4 @@
1
+ Just off the shores of Never Land
2
+ Ahh coconuts!
3
+ Yo Ho! Yo Ho!
4
+ Let's Go! Let's Go!
@@ -0,0 +1,4 @@
1
+ Just off the shores of Never Land
2
+ A hideaway at sea
3
+ Yo Ho! Yo Ho!
4
+ Let's Go! Let's Go!
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ module RevealCK
4
+ describe Config do
5
+
6
+ context 'when no config is supplied' do
7
+
8
+ let :config do
9
+ Config.new
10
+ end
11
+
12
+ it '#title defaults to "Slides"' do
13
+ config.title.should == "Slides"
14
+ end
15
+
16
+ it '#author defaults to "Hakim El Hattab"' do
17
+ config.author.should == "Hakim El Hattab"
18
+ end
19
+
20
+ it '#theme defaults to "default"' do
21
+ config.theme.should == "default"
22
+ end
23
+
24
+ end
25
+
26
+ context 'when a config is supplied' do
27
+
28
+ let :config_file do
29
+ File.join 'spec', 'data', 'config', 'config.toml'
30
+ end
31
+
32
+ let :config do
33
+ Config.new config_file: config_file
34
+ end
35
+
36
+ it '#title comes from the config file' do
37
+ expect(config.title).to eq "The Never Sea Slides"
38
+ end
39
+
40
+ it '#author comes from the config file' do
41
+ expect(config.author).to eq "Captain Hook"
42
+ end
43
+
44
+ it '#theme comes from the config file' do
45
+ config.theme.should == "night"
46
+ end
47
+
48
+ end
49
+ end
50
+ end