Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
(GH1841) fixes dist issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher McCulloh committed Aug 19, 2016
1 parent 223f8df commit b4161dd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 39 deletions.
14 changes: 7 additions & 7 deletions js/pillbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

// -- BEGIN UMD WRAPPER PREFACE --

// WARNING: Anything placed inside of the UMD Wrapper may be stripped out by dist task

// For more information on UMD visit:
// https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
(function umdWrapper (factory) {
Expand All @@ -31,6 +33,11 @@
if (!$.fn.utilities) {
throw new Error('Fuel UX pillbox control requires FuelUX utilities.');
}
// -- END UMD WRAPPER PREFACE --

// -- BEGIN MODULE CODE HERE --
var old = $.fn.pillbox;

var utilities = $.fn.utilities;
var CONST = $.fn.utilities.CONST;
var COMMA_KEYCODE = CONST.COMMA_KEYCODE;
Expand All @@ -43,14 +50,7 @@
var cleanInput = utilities.cleanInput;
var isShiftHeld = utilities.isShiftHeld;

// -- END UMD WRAPPER PREFACE --

// -- BEGIN MODULE CODE HERE --

var old = $.fn.pillbox;

// PILLBOX CONSTRUCTOR AND PROTOTYPE

var Pillbox = function Pillbox (element, options) {
this.$element = $(element);
this.$moreCount = this.$element.find('.pillbox-more-count');
Expand Down
27 changes: 6 additions & 21 deletions js/utilities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global someFunction jQuery:true */
/* global jQuery:true */

/*
* Fuel UX Utilities
Expand All @@ -17,31 +17,16 @@

(function umdFactory (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
// if AMD loader is available, register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = function commonJS ( root, jq ) {
var jQuery = jq;
if ( jQuery === undefined ) {
// require('jQuery') returns a factory that requires window to
// build a jQuery instance, we normalize how we use modules
// that require this pattern but the window provided is a noop
// if it's defined (how jquery works)
if ( typeof window !== 'undefined' ) {
jQuery = require('jquery');
} else {
jQuery = require('jquery')(root);
}
}
factory(jQuery);
return jQuery;
};
module.exports = factory(require('jquery'));
} else {
// Browser globals
// OR use browser globals if AMD is not present
factory(jQuery);
}
}(function defineModule ($) {
}(function utilities ($) {
// -- END UMD WRAPPER PREFACE --
// -- BEGIN MODULE CODE HERE --

Expand Down
24 changes: 13 additions & 11 deletions test/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,27 @@
<link href="../dist/css/fuelux.css" rel="stylesheet" type="text/css">

<script src="../bower_components/qunit/qunit/qunit.js"></script>
<script>QUnit.config.autostart = false;</script>
<script>
/* global QUnit:true */
QUnit.config.autostart = false;
</script>
<script src="../bower_components/requirejs/require.js"></script>

<!--[if gte IE 9]> -->
<script type="text/javascript" src="../bower_components/blanket/dist/qunit/blanket.js" data-cover-only="/js" data-cover-never="/bower_components"></script>
<!-- <![endif]-->

<script>
(function () {

/* global blanket:true */
(function onPageLoad () {
/* - - - - - - - - - - - - - - - - - -
URL PARAMETER CONFIGURATION
- - - - - - - - - - - - - - - - - - */

// jQuery config
var jQueryPath;
// Feature detect
if('querySelector' in document
if ('querySelector' in document
&& 'localStorage' in window
&& 'addEventListener' in window ) {
jQueryPath = 'bower_components/jquery/dist/jquery'; // v2.x
Expand All @@ -37,7 +40,7 @@
var jQueryVersionParameter = location.search.match(/[?&]jquery=(.*?)(?=&|$)/);
var jQueryVersion = (jQueryVersionParameter) ? jQueryVersionParameter[1] : undefined;
// if jquery version does not use dist folder
if(jQueryVersion == '1.9.1') {
if (jQueryVersion === '1.9.1') {
jQueryPath = 'bower_components/jquery-' + jQueryVersion + '/jquery';
}

Expand All @@ -53,7 +56,7 @@
jquery: jQueryPath,
bootstrap: 'bower_components/bootstrap/dist/js/bootstrap',
fuelux: 'js',
tests: window.noMoment ? 'test/tests-no-moment' : 'test/tests' ,
tests: window.noMoment ? 'test/tests-no-moment' : 'test/tests',
text: 'bower_components/requirejs-text/text'
},
shim: {
Expand All @@ -70,13 +73,13 @@

// have Blanket coverage test talk to grunt via alert()
if (location.href.match(/(\?|&)gruntReport($|&|=)/)) {
blanket.options("reporter", "/node_modules/grunt-blanket-qunit/reporter/grunt-reporter.js");
blanket.options('reporter', '/node_modules/grunt-blanket-qunit/reporter/grunt-reporter.js');
}

// default to not testing dist
var testdistParameter = location.search.match(/[?&]testdist=(true|false?)(?=&|$)/);
var testdist = (testdistParameter && testdistParameter[1] === 'true') ? true : false;
if(testdist){
if (testdist) {
// map all requests for individual modules to merged library
requireConfig.map = {
'*': {
Expand All @@ -101,13 +104,12 @@
'fuelux/utilities': 'dist/js/fuelux.min',
'fuelux/wizard': 'dist/js/fuelux.min'
}
}
};
}

require.config(requireConfig);

require(['jquery', 'tests'], function() {});

require(['jquery', 'tests'], function noop () {});
})();
</script>
</head>
Expand Down

0 comments on commit b4161dd

Please sign in to comment.