Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed wrappedMarkup property into renderMarkupPropery #785

Merged
merged 1 commit into from
Sep 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/app/js/controllers/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ angular.module('sgApp')
$scope.nextSection = nextSection(sections, result);
$scope.section = element;
$scope.variables = Variables.variables;
$scope.markup = $filter('setVariables')($filter('setModifierClass')(element.wrappedMarkup, element.className), $scope.variables);
$scope.markup = $filter('setVariables')($filter('setModifierClass')(element.renderMarkup, element.className), $scope.variables);
}
}
});
2 changes: 1 addition & 1 deletion lib/app/js/controllers/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ angular.module('sgApp')
}

$scope.isEmptyMainSection = function(section) {
return section.reference.indexOf('.') === -1 && !section.wrappedMarkup && (!section.modifiers || section.modifiers.length === 0);
return section.reference.indexOf('.') === -1 && !section.renderMarkup && (!section.modifiers || section.modifiers.length === 0);
};

$scope.isActive = function(section) {
Expand Down
4 changes: 2 additions & 2 deletions lib/app/views/partials/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1 class="sg">
</a>
</div>
<shadow-dom>
<div ng-bind-html="mod.wrappedMarkup | setModifierClass: mod.className | setVariables: variables | addWrapper | unsafe" dynamic-compile></div>
<div ng-bind-html="mod.renderMarkup | setModifierClass: mod.className | setVariables: variables | addWrapper | unsafe" dynamic-compile></div>
</shadow-dom>
</div>
<div ng-repeat-end></div>
Expand All @@ -40,7 +40,7 @@ <h1 class="sg">
</div>

<shadow-dom>
<div ng-bind-html="section.wrappedMarkup | setVariables: variables | addWrapper | unsafe" dynamic-compile></div>
<div ng-bind-html="section.renderMarkup | setVariables: variables | addWrapper | unsafe" dynamic-compile></div>
</shadow-dom>
</div>

Expand Down
8 changes: 4 additions & 4 deletions lib/modules/wrapper-markup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ function generateSectionWrapperMarkup(sections) {
section.wrapper = wrapper;
if (section.markup) {
/* Wrap markup */
section.wrappedMarkup = section.markup;
section.wrappedMarkup = section.wrapper.replace(wrapperKeyword, section.markup);
section.renderMarkup = section.markup;
section.renderMarkup = section.wrapper.replace(wrapperKeyword, section.markup);
}

/* Wrap modifiers */
section.modifiers.forEach(function(modifier) {
/* Wrap modifier markup */
modifier.wrappedMarkup = modifier.markup;
modifier.wrappedMarkup = section.wrapper.replace(wrapperKeyword, modifier.markup);
modifier.rederMarkup = modifier.markup;
modifier.renderMarkup = section.wrapper.replace(wrapperKeyword, modifier.markup);
});

/* Clean nested sections */
Expand Down
2 changes: 1 addition & 1 deletion test/angular/unit/controllers/element.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('ElementCtrl', function() {
id: 1
}
],
wrappedMarkup: '<div>foo</div>'
renderMarkup: '<div>foo</div>'
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions test/angular/unit/controllers/sections.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('SectionsCtrl', function() {
var section = {
header: 'Section header text',
reference: '1',
wrappedMarkup: '',
renderMarkup: '',
markup: ''
};
expect(scope.isEmptyMainSection(section)).to.eql(true);
Expand All @@ -101,7 +101,7 @@ describe('SectionsCtrl', function() {
var section = {
header: 'Section header text',
reference: '1.1',
wrappedMarkup: '',
renderMarkup: '',
markup: ''
};
expect(scope.isEmptyMainSection(section)).to.eql(false);
Expand All @@ -111,7 +111,7 @@ describe('SectionsCtrl', function() {
var section = {
header: 'Section header text',
reference: '1',
wrappedMarkup: '<p>Test</p>',
renderMarkup: '<p>Test</p>',
markup: '<p>Test</p>'
};
expect(scope.isEmptyMainSection(section)).to.eql(false);
Expand Down
12 changes: 6 additions & 6 deletions test/unit/modules/wrapper-markup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,32 +125,32 @@ describe('KSS wrapper markup generator', function() {

it('should not add wrapper to the parent sections', function() {
var wrappedMarkup = '<container></container>';
expect(removeLinebreaks(json.sections[0].wrappedMarkup)).eql(wrappedMarkup);
expect(removeLinebreaks(json.sections[0].renderMarkup)).eql(wrappedMarkup);
});

it('should add wrapper markup to the current section', function() {
var wrappedMarkup = '<outer-wrapper><p>Content inside outer wrapper</p></outer-wrapper>';
expect(removeLinebreaks(json.sections[1].wrappedMarkup)).eql(wrappedMarkup);
expect(removeLinebreaks(json.sections[1].renderMarkup)).eql(wrappedMarkup);
});

it('should inherit wrapper markup to the subsection', function() {
var wrappedMarkup = '<outer-wrapper><p>Content inside outer wrapper</p></outer-wrapper>';
expect(removeLinebreaks(json.sections[2].wrappedMarkup)).eql(wrappedMarkup);
expect(removeLinebreaks(json.sections[2].renderMarkup)).eql(wrappedMarkup);
});

it('should inherit wrapper markup to the subsection with the current wrapper markup', function() {
var wrappedMarkup = '<outer-wrapper><inner-wrapper><p>Content inside inner and outer wrapper</p></inner-wrapper></outer-wrapper>';
expect(removeLinebreaks(json.sections[3].wrappedMarkup)).eql(wrappedMarkup);
expect(removeLinebreaks(json.sections[3].renderMarkup)).eql(wrappedMarkup);
});

it('should inherit all parent wrapper markups to the sub-sub-section', function() {
var wrappedMarkup = '<outer-wrapper><inner-wrapper><p>Second level content</p></inner-wrapper></outer-wrapper>';
expect(removeLinebreaks(json.sections[4].wrappedMarkup)).eql(wrappedMarkup);
expect(removeLinebreaks(json.sections[4].renderMarkup)).eql(wrappedMarkup);
});

it('should work for modifiers', function() {
var wrappedMarkup = '<wrapper><button class="modifier"></button></wrapper>';
expect(removeLinebreaks(json.sections[5].modifiers[0].wrappedMarkup)).eql(wrappedMarkup);
expect(removeLinebreaks(json.sections[5].modifiers[0].renderMarkup)).eql(wrappedMarkup);
});

});