Skip to content

Commit

Permalink
#390: Add remark-slide-incremental CSS class to incremental slides.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnab committed Nov 13, 2016
1 parent bb0aab3 commit 2951555
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/remark/views/slideView.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ SlideView.prototype.configureElements = function () {
self.scalingElement = document.createElement('div');
self.scalingElement.className = 'remark-slide-scaler';

self.element = document.createElement('div');
self.element.className = 'remark-slide';
self.element = createSlideElement(self.slide);

self.contentElement = createContentElement(self.events, self.slideshow, self.slide);
self.notesElement = createNotesElement(self.slideshow, self.slide.notes);
Expand Down Expand Up @@ -135,6 +134,17 @@ SlideView.prototype.scaleBackgroundImage = function (dimensions) {
}
};

function createSlideElement(slide) {
var element = document.createElement('div');
element.className = 'remark-slide';

if (slide.properties.continued === 'true') {
utils.addClass(element, 'remark-slide-incremental');
}

return element;
}

function createContentElement (events, slideshow, slide) {
var element = document.createElement('div');

Expand Down
13 changes: 13 additions & 0 deletions test/remark/views/slideView_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ describe('SlideView', function () {
classes.should.containEql('middle');
classes.should.containEql('center');
});

it('should set remark-slide-incremental class for incremental slides', function () {
var slide = new Slide(2, {
source: '',
properties: {'continued': 'true'}
});

slideshow.slides.push(slide);
var slideView = new SlideView(new EventEmitter(), slideshow, scaler, slide);
var classes = utils.getClasses(slideView.element)

classes.should.containEql('remark-slide-incremental');
});
});

describe('empty paragraph removal', function () {
Expand Down

0 comments on commit 2951555

Please sign in to comment.