Merge pull request #1772 from akamike/fix_setclasses_build_query

Fix build query not including setclasses when passed as an option
This commit is contained in:
Ryan Seddon
2015-11-27 13:41:01 +11:00
4 changed files with 10 additions and 9 deletions

View File

@@ -27,9 +27,6 @@ define(['lodash', 'metadata'], function(_, metadata) {
// A few of the values have to be massaged in order to match
// the `value`
var opts = _.map(config.options, function(opt) {
if (opt == 'setClasses') {
return 'cssclasses';
}
if (opt.indexOf('html5') === 0) {
opt = opt.replace('html5', '');
}

View File

@@ -23,9 +23,6 @@ define(['lodash'], function(_) {
// Some special cases
var setClasses = _.contains(config.options, 'setClasses');
// Remove the special cases
config.options = _.without(config.options, 'setClasses');
var output = 'require(["ModernizrProto", "Modernizr", "testRunner"';
// Needed named module requires
@@ -38,8 +35,9 @@ define(['lodash'], function(_) {
config.options = _.without(config.options, 'html5shiv');
}
// Load in the rest of the options (they dont return values, so they aren't declared
_.forEach(config.options, function(option) {
// Load in the rest of the options, excluding special cases
// (they dont return values, so they aren't declared)
_.forEach(_.without(config.options, 'setClasses'), function(option) {
output += ', "' + option + '"';
});

View File

@@ -93,6 +93,12 @@ describe('generate', function() {
window.require = stashedRequire;
});
it('does not modify options', function() {
var config = {'options': ['setClasses']};
generate(config);
expect(config['options']).to.eql(['setClasses']);
});
after(function() {
cleanup();
});

View File

@@ -62,7 +62,7 @@ describe('build-query', function() {
classPrefix: 'TEST_PREFIX',
options: ['setClasses']
});
expect(query).to.be('?-cssclasses-dontmin-cssclassprefix:TEST_PREFIX');
expect(query).to.be('?-setclasses-dontmin-cssclassprefix:TEST_PREFIX');
});
it('strips `html5` from the shiv options', function() {