Comparing version 3.11.1 to 3.11.2
@@ -23,3 +23,3 @@ { | ||
"bootstrap": "3.x", | ||
"moment": "2.x" | ||
"moment": "^2.10.6" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
986
Gruntfile.js
@@ -6,4 +6,12 @@ /*jshint expr:true*/ | ||
function getPackageVersion() { | ||
return grunt.file.readJSON('./package.json').version; | ||
/* | ||
* Welcome to our GruntFile.js! | ||
* Configuration tasks (initConfig) are external JS modules that can be found in | ||
* `./grunt/config`. Additional custom tasks can be found in `./grunt/task`. | ||
* The "shared variables" belowcannot use grunt.config(), | ||
* since it has not been initialized yet, until grunt.initConfig() is executed. | ||
*/ | ||
function getPackage() { | ||
return grunt.file.readJSON('./package.json'); | ||
} | ||
@@ -14,939 +22,69 @@ | ||
// external libraries | ||
var semver = require('semver'); | ||
var packageVersion = getPackage().version; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var commonJSBundledReferenceModule = require('./grunt/commonjs-reference-module.js'); | ||
var commonJSBundledReferenceModule = require('./grunt/other/commonjs-reference-module.js'); | ||
// Project configuration. | ||
grunt.initConfig({ | ||
// Metadata | ||
bannerRelease: '/*!\n' + | ||
' * Fuel UX v<%= pkg.version %> \n' + | ||
' * Copyright 2012-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' + | ||
' * Licensed under the <%= pkg.license.type %> license (<%= pkg.license.url %>)\n' + | ||
' */\n', | ||
banner: '/*!\n' + | ||
' * Fuel UX EDGE - Built <%= grunt.template.today("yyyy/mm/dd, h:MM:ss TT") %> \n' + | ||
' * Previous release: v<%= pkg.version %> \n' + | ||
' * Copyright 2012-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' + | ||
' * Licensed under the <%= pkg.license.type %> license (<%= pkg.license.url %>)\n' + | ||
' */\n', | ||
bump: { | ||
options: { | ||
files: ['package.json'], | ||
updateConfigs: ['pkg'], | ||
commit: false, | ||
createTag: false, | ||
tagName: '%VERSION%', | ||
tagMessage: '%VERSION%', | ||
push: false, | ||
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' | ||
} | ||
}, | ||
// default variables for release task | ||
release: { | ||
files: ['dist', 'README.md', 'DETAILS.md', 'bower.json', 'package.json'], | ||
localBranch: 'release', | ||
remoteBaseBranch: 'master', | ||
remoteDestinationBranch: '3.x', | ||
remoteRepository: 'upstream', | ||
}, | ||
jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Fuel UX\\\'s JavaScript requires jQuery\') }\n\n', | ||
bootstrapCheck: 'if (typeof jQuery.fn.dropdown === \'undefined\' || typeof jQuery.fn.collapse === \'undefined\') ' + | ||
'{ throw new Error(\'Fuel UX\\\'s JavaScript requires Bootstrap\') }\n\n', | ||
pkg: grunt.file.readJSON('package.json'), | ||
// Try ENV variables (export SAUCE_ACCESS_KEY=XXXX), if key doesn't exist, try key file | ||
sauceLoginFile: grunt.file.exists('SAUCE_API_KEY.yml') ? grunt.file.readYAML('SAUCE_API_KEY.yml') : undefined, | ||
cdnLoginFile: grunt.file.exists('FUEL_CDN.yml') ? grunt.file.readYAML('FUEL_CDN.yml') : undefined, | ||
sauceUser: process.env.SAUCE_USERNAME || 'fuelux', | ||
sauceKey: process.env.SAUCE_ACCESS_KEY ? process.env.SAUCE_ACCESS_KEY : '<%= sauceLoginFile.key %>', | ||
// TEST URLS | ||
allTestUrls: ['2.1.0', '1.11.0', '1.9.1', 'browserGlobals', 'noMoment', 'codeCoverage' ].map(function (type) { | ||
if (type === 'browserGlobals') { | ||
return 'http://localhost:<%= connect.testServer.options.port %>/test/browser-globals.html'; | ||
} | ||
else if (type === 'codeCoverage') { | ||
return 'http://localhost:<%= connect.testServer.options.port %>/test/?coverage=true'; | ||
} | ||
else if (type === 'noMoment') { | ||
return 'http://localhost:<%= connect.testServer.options.port %>/test/?no-moment=true'; | ||
} | ||
else { | ||
// test dist with multiple jQuery versions | ||
return 'http://localhost:<%= connect.testServer.options.port %>/test/?testdist=true'; | ||
} | ||
}), | ||
// variables used in shared variables below | ||
var connectTestServerOptionsPort = 9000; | ||
//Tasks configuration | ||
blanket_qunit: { | ||
source: { | ||
options: { | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/?coverage=true&gruntReport'], | ||
threshold: 1, | ||
globalThreshold: 1 | ||
} | ||
} | ||
// load and initialize configuration tasks, including package.json's devDependencies | ||
require('load-grunt-config')(grunt, { | ||
configPath: path.join(process.cwd(), 'grunt/config'), | ||
loadGruntTasks: { | ||
pattern: 'grunt-*', | ||
config: require('./package.json'), | ||
scope: 'devDependencies' | ||
}, | ||
browserify: { | ||
commonjs: { | ||
files: { | ||
'test/commonjs-bundle.js': ['test/commonjs-test.js'], | ||
data: { | ||
// Variables shared across configuration tasks, use templates, <%= %>, to access | ||
// within configuration tasks | ||
bannerRelease: '/*!\n' + | ||
' * Fuel UX v<%= pkg.version %> \n' + | ||
' * Copyright 2012-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' + | ||
' * Licensed under the <%= pkg.license.type %> license (<%= pkg.license.url %>)\n' + | ||
' */\n', | ||
banner: '/*!\n' + | ||
' * Fuel UX EDGE - Built <%= grunt.template.today("yyyy/mm/dd, h:MM:ss TT") %> \n' + | ||
' * Previous release: v<%= pkg.version %> \n' + | ||
' * Copyright 2012-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' + | ||
' * Licensed under the <%= pkg.license.type %> license (<%= pkg.license.url %>)\n' + | ||
' */\n', | ||
jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Fuel UX\\\'s JavaScript requires jQuery\') }\n\n', | ||
bootstrapCheck: 'if (typeof jQuery.fn.dropdown === \'undefined\' || typeof jQuery.fn.collapse === \'undefined\') ' + | ||
'{ throw new Error(\'Fuel UX\\\'s JavaScript requires Bootstrap\') }\n\n', | ||
pkg: getPackage(), | ||
// Try ENV variables (export SAUCE_ACCESS_KEY=XXXX), if key doesn't exist, try key file | ||
sauceLoginFile: grunt.file.exists('SAUCE_API_KEY.yml') ? grunt.file.readYAML('SAUCE_API_KEY.yml') : undefined, | ||
cdnLoginFile: grunt.file.exists('FUEL_CDN.yml') ? grunt.file.readYAML('FUEL_CDN.yml') : undefined, | ||
sauceUser: process.env.SAUCE_USERNAME || 'fuelux', | ||
sauceKey: process.env.SAUCE_ACCESS_KEY ? process.env.SAUCE_ACCESS_KEY : '<%= sauceLoginFile.key %>', | ||
// TEST URLS | ||
allTestUrls: ['2.1.0', '1.11.0', '1.9.1', 'browserGlobals', 'noMoment', 'codeCoverage' ].map(function (type) { | ||
if (type === 'browserGlobals') { | ||
return 'http://localhost:' + connectTestServerOptionsPort + '/test/browser-globals.html'; | ||
} | ||
} | ||
}, | ||
clean: { | ||
dist: ['dist'], | ||
zipsrc: ['dist/fuelux'],// temp folder | ||
screenshots: ['page-at-timeout-*.jpg'] | ||
}, | ||
compress: { | ||
zip: { | ||
files: [ | ||
{ | ||
cwd: 'dist/', | ||
expand: true, | ||
src: ['fuelux/**'] | ||
} | ||
], | ||
options: { | ||
archive: 'dist/fuelux.zip', | ||
mode: 'zip' | ||
else if (type === 'codeCoverage') { | ||
return 'http://localhost:' + connectTestServerOptionsPort + '/test/?coverage=true'; | ||
} | ||
} | ||
}, | ||
concat: { | ||
// manually concatenate JS files (due to dependency management) | ||
fuelux: { | ||
src: [ | ||
'js/checkbox.js', | ||
'js/combobox.js', | ||
'js/datepicker.js', | ||
'js/dropdown-autoflip.js', | ||
'js/loader.js', | ||
'js/placard.js', | ||
'js/radio.js', | ||
'js/search.js', | ||
'js/selectlist.js', | ||
'js/spinbox.js', | ||
'js/tree.js', | ||
'js/wizard.js', | ||
//items with dependencies on other controls | ||
'js/infinite-scroll.js', | ||
'js/pillbox.js', | ||
'js/repeater.js', | ||
'js/repeater-list.js', | ||
'js/repeater-thumbnail.js', | ||
'js/scheduler.js' | ||
], | ||
dest: 'dist/js/<%= pkg.name %>.js' | ||
}, | ||
options: { | ||
banner: '<%= banner %>' + '\n\n' + | ||
'// For more information on UMD visit: https://github.com/umdjs/umd/' + '\n' + | ||
'(function (factory) {' + '\n' + | ||
'\tif (typeof define === \'function\' && define.amd) {' + '\n' + | ||
'\t\tdefine([\'jquery\', \'bootstrap\'], factory);' + '\n' + | ||
'\t} else {' + '\n' + | ||
'\t\tfactory(jQuery);' + '\n' + | ||
'\t}' + '\n' + | ||
'}(function (jQuery) {\n\n' + | ||
'<%= jqueryCheck %>' + | ||
'<%= bootstrapCheck %>', | ||
footer: '\n}));', | ||
process: function (source) { | ||
source = '(function ($) {\n\n' + | ||
source.replace(/\/\/ -- BEGIN UMD WRAPPER PREFACE --(\n|.)*\/\/ -- END UMD WRAPPER PREFACE --/g, ''); | ||
source = source.replace(/\/\/ -- BEGIN UMD WRAPPER AFTERWORD --(\n|.)*\/\/ -- END UMD WRAPPER AFTERWORD --/g, '') + '\n})(jQuery);\n\n'; | ||
return source; | ||
else if (type === 'noMoment') { | ||
return 'http://localhost:' + connectTestServerOptionsPort + '/test/?no-moment=true'; | ||
} | ||
} | ||
}, | ||
connect: { | ||
server: { | ||
options: { | ||
hostname: '*', | ||
base: { | ||
path: '.', | ||
options: { | ||
index: ['index.html', 'tests.html'], | ||
} | ||
}, | ||
port: process.env.PORT || 8000, | ||
useAvailablePort: true // increment port number, if unavailable... | ||
else { | ||
// test dist with multiple jQuery versions | ||
return 'http://localhost:' + connectTestServerOptionsPort + '/test/?testdist=true'; | ||
} | ||
}, | ||
testServer: { | ||
options: { | ||
base: { | ||
path: '.', | ||
options: { | ||
index: ['index.html', 'tests.html'], | ||
} | ||
}, | ||
hostname: '*', | ||
port: 9000, // allows main server to be run simultaneously | ||
useAvailablePort: true// increment port number, if unavailable... | ||
} | ||
} | ||
}, | ||
copy: { | ||
fonts: { | ||
cwd: 'fonts/', | ||
dest: 'dist/fonts/', | ||
expand: true, | ||
filter: 'isFile', | ||
src: ['*'] | ||
}, | ||
zipsrc: { | ||
cwd: 'dist/', | ||
dest: 'dist/fuelux/', | ||
expand: true, | ||
src: ['**'] | ||
} | ||
}, | ||
htmllint: { | ||
options: { | ||
ignore:[ | ||
'Section lacks heading. Consider using “h2”-“h6” elements to add identifying headings to all sections.', | ||
'Bad value X-UA-Compatible for attribute http-equiv on element meta.', | ||
'Element head is missing a required instance of child element title.' | ||
], | ||
force: true | ||
}, | ||
src: ['index.html', 'markup/*.html', 'test/markup/*.html'] | ||
}, | ||
jsbeautifier: { | ||
files: ['dist/js/fuelux.js'], | ||
options: { | ||
js: { | ||
braceStyle: 'collapse', | ||
breakChainedMethods: false, | ||
e4x: false, | ||
evalCode: false, | ||
indentLevel: 0, | ||
indentSize: 4, | ||
indentWithTabs: true, | ||
jslintHappy: false, | ||
keepArrayIndentation: false, | ||
keepFunctionIndentation: false, | ||
maxPreserveNewlines: 10, | ||
preserveNewlines: true, | ||
spaceBeforeConditional: true, | ||
spaceInParen: true, | ||
unescapeStrings: false, | ||
wrapLineLength: 0 | ||
} | ||
} | ||
}, | ||
jshint: { | ||
options: { | ||
boss: true, | ||
browser: true, | ||
curly: false, | ||
eqeqeq: true, | ||
eqnull: true, | ||
globals: { | ||
jQuery: true, | ||
define: true, | ||
require: true, | ||
module: true | ||
}, | ||
immed: true, | ||
latedef: true, | ||
newcap: true, | ||
noarg: true, | ||
sub: true, | ||
undef: true, | ||
unused: false// changed | ||
}, | ||
sourceAndDist: ['Gruntfile.js', 'js/*.js', 'dist/fuelux.js'], | ||
tests: { | ||
options: { | ||
latedef: false, | ||
undef: false, | ||
unused: false | ||
}, | ||
files: { | ||
src: ['test/**/*.js','!test/commonjs-bundle.js'] | ||
} | ||
} | ||
}, | ||
qunit: { | ||
//run with `grunt releasetest` or `grunt travisci`. Requires connect server to be running. | ||
release: { | ||
options: { | ||
urls: '<%= allTestUrls %>', | ||
screenshot: true, | ||
page: { | ||
viewportSize: { | ||
width: 1280, | ||
height: 1024 | ||
} | ||
} | ||
} | ||
}, | ||
globals: { | ||
options: { | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/browser-globals.html'] | ||
} | ||
}, | ||
noMoment: { | ||
options: { | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/?no-moment=true'] | ||
} | ||
}, | ||
// `grunt qunit:source` will test the source files directly. | ||
source: { | ||
options: { | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/'] | ||
} | ||
}, | ||
dist: { | ||
options: { | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/?testdist=true', | ||
'http://localhost:<%= connect.testServer.options.port %>/test/commonjs.html'] | ||
} | ||
} | ||
}, | ||
less: { | ||
dev: { | ||
options: { | ||
strictMath: true, | ||
sourceMap: true, | ||
outputSourceFiles: true, | ||
sourceMapURL: '<%= pkg.name %>-dev.css.map', | ||
sourceMapFilename: 'dist/css/<%= pkg.name %>-dev.css.map' | ||
}, | ||
files: { | ||
'dist/css/fuelux-dev.css': 'less/fuelux.less' | ||
} | ||
}, | ||
dist: { | ||
options: { | ||
strictMath: true, | ||
sourceMap: true, | ||
outputSourceFiles: true, | ||
sourceMapURL: '<%= pkg.name %>.css.map', | ||
sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map' | ||
}, | ||
files: { | ||
'dist/css/fuelux.css': 'less/fuelux.less' | ||
} | ||
}, | ||
minify: { | ||
options: { | ||
cleancss: true, | ||
compress: true, | ||
report: 'min' | ||
}, | ||
files: { | ||
'dist/css/<%= pkg.name %>.min.css': 'dist/css/<%= pkg.name %>.css' | ||
} | ||
} | ||
}, | ||
prompt: { | ||
// asks for what version you want to build | ||
'tempbranch': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.remoteRepository', | ||
default : '<%= release.remoteRepository %>', | ||
type: 'input', | ||
message: function() { | ||
return 'What repository would like to base your local release branch from?'; | ||
} | ||
}, | ||
{ | ||
// Assumption is made that you are releasing the code within a "release branch" currently | ||
// on the upstream remote repo. This branch will be tracked locally and be used to run | ||
// the build process in. It will be named release_{BUILD_VERSION}_{MMSS} (that is, it will | ||
// use the version specified earlier and a "mini-timestamp" of the current hour and minute). | ||
config: 'release.remoteBaseBranch', | ||
type: 'input', | ||
default : '<%= release.remoteBaseBranch %>', | ||
message: function() { | ||
return 'What remote branch from ' + grunt.config('release.remoteRepository') + | ||
' would like to build your release based on?'; | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
// asks for what version you want to build | ||
'build': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.buildSemVerType', | ||
type: 'list', | ||
message: 'What would you like to do?', | ||
choices: [ | ||
{ | ||
value: 'patch', | ||
name: 'Patch: ' + semver.inc(getPackageVersion(), 'patch') + ' Backwards-compatible bug fixes.' | ||
}, | ||
{ | ||
value: 'minor', | ||
name: 'Minor: ' + semver.inc(getPackageVersion(), 'minor') + ' Add functionality in a backwards-compatible manner.' | ||
}, | ||
{ | ||
value: 'major', | ||
name: 'Major: ' + semver.inc(getPackageVersion(), 'major') + ' Incompatible API changes.' | ||
}, | ||
{ | ||
value: 'custom', | ||
name: 'Custom: ?.?.? Specify version...' | ||
} | ||
] | ||
}, | ||
{ | ||
// if custom bump is used with a specific version, see dorelease task | ||
config: 'release.buildSemVerType', | ||
type: 'input', | ||
message: 'What specific version would you like', | ||
when: function (answers) { | ||
return answers['release.buildSemVerType'] === 'custom'; | ||
}, | ||
validate: function (value) { | ||
var valid = semver.valid(value); | ||
return valid || 'Must be a valid semver, such as 1.2.3-rc1. See http://semver.org/ for more details.'; | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
'commit': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.commit', | ||
type: 'confirm', | ||
message: 'Please review your files. Would you like to commit?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.commit'] === true) { | ||
grunt.task.run(['shell:commit']); | ||
} | ||
return false; | ||
} | ||
} | ||
}, | ||
'tag': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.tag', | ||
type: 'confirm', | ||
message: 'Would you like to tag as ' + '<%= pkg.version %>' + '?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.tag'] === true) { | ||
grunt.task.run(['shell:tag']); | ||
} | ||
return false; | ||
} | ||
} | ||
}, | ||
'pushLocalBranchToUpstream': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.remoteDestinationBranch', | ||
type: 'input', | ||
message: function() { | ||
return 'What upstream branch would you like to push ' + grunt.config('release.localBranch') + | ||
' to (probably ' + grunt.config('release.remoteDestinationBranch') + ')? (leave blank to skip)'; | ||
} | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.remoteDestinationBranch'] !== '' && answers['release.remoteDestinationBranch'] !== 'n' ) { | ||
grunt.task.run(['shell:pushLocalBranchToUpstream']); | ||
} | ||
return false; | ||
} | ||
} | ||
}, | ||
'pushTagToUpstream': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.upstreamTag', | ||
type: 'confirm', | ||
message: 'Would you like to push tag ' + '<%= pkg.version %>' + ' to upstream?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.upstreamTag'] === true) { | ||
grunt.task.run(['shell:pushTagToUpstream']); | ||
} | ||
return false; | ||
} | ||
} | ||
}, | ||
'uploadToCDN': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.uploadToCDN', | ||
type: 'confirm', | ||
message: 'Would you like to upload the `dist folder to fuelcdn.com?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.uploadToCDN'] === true) { | ||
grunt.task.run(['shell:uploadToCDN']); | ||
} | ||
return false; | ||
} | ||
} | ||
}, | ||
'pushLocalBranchToUpstreamMaster': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.pushToUpstreamMaster', | ||
type: 'confirm', | ||
message: 'Would you like to push your local release branch to upstream\'s master branch?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.pushToUpstreamMaster'] === true) { | ||
grunt.task.run(['shell:pushLocalBranchToUpstreamMaster']); | ||
} | ||
return false; | ||
} | ||
} | ||
}, | ||
'deleteLocalReleaseBranch': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.deleteLocalReleaseBranch', | ||
type: 'confirm', | ||
message: function() { | ||
return 'Would you like to delete your local release branch' + '?'; | ||
} | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.deleteLocalReleaseBranch'] === true) { | ||
grunt.task.run(['shell:deleteLocalReleaseBranch']); | ||
} | ||
return false; | ||
} | ||
} | ||
} | ||
}, | ||
replace: { | ||
readme: { | ||
src: ['DETAILS.md', 'README.md'], | ||
overwrite: true,// overwrite matched source files | ||
replacements: [{ | ||
from: /fuelux\/\d\.\d\.\d/g, | ||
to: "fuelux/<%= pkg.version %>" | ||
}] | ||
} | ||
}, | ||
'saucelabs-qunit': { | ||
trickyBrowsers: { | ||
options: { | ||
username: '<%= sauceUser %>', | ||
key: '<%= sauceKey %>', | ||
tunnelTimeout: 45, | ||
testInterval: 3000, | ||
tags: ['<%= sauceUser %>' + '@' + process.env.TRAVIS_BRANCH || '<%= sauceUser %>' + '@local'], | ||
browsers: grunt.file.readYAML('sauce_browsers_tricky.yml'), | ||
build: process.env.TRAVIS_BUILD_NUMBER || '<%= pkg.version %>', | ||
testname: process.env.TRAVIS_JOB_ID || Math.floor((new Date()).getTime() / 1000 - 1230768000).toString(), | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/?testdist=true'] | ||
} | ||
}, | ||
defaultBrowsers: { | ||
options: { | ||
username: '<%= sauceUser %>', | ||
key: '<%= sauceKey %>', | ||
tunnelTimeout: 45, | ||
testInterval: 3000, | ||
tags: ['<%= pkg.version %>', '<%= sauceUser %>' + '@' + process.env.TRAVIS_BRANCH || '<%= sauceUser %>@local'], | ||
browsers: grunt.file.readYAML('sauce_browsers.yml'), | ||
build: process.env.TRAVIS_BUILD_NUMBER || '<%= pkg.version %>', | ||
testname: process.env.TRAVIS_JOB_ID || '<%= pkg.version %>-<%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %>', | ||
urls: ['http://localhost:<%= connect.testServer.options.port %>/test/?testdist=true'], | ||
maxPollRetries: 4, | ||
throttled: 3, | ||
maxRetries: 3 | ||
} | ||
}, | ||
all: { | ||
options: { | ||
username: '<%= sauceUser %>', | ||
key: '<%= sauceKey %>', | ||
browsers: grunt.file.readYAML('sauce_browsers.yml'), | ||
build: process.env.TRAVIS_BUILD_NUMBER || '<%= pkg.version %>', | ||
testname: 'grunt-<%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %>', | ||
urls: '<%= allTestUrls %>' | ||
} | ||
} | ||
}, | ||
shell: { | ||
// Compile release notes while waiting for tests to pass. Needs Ruby gem and ONLY LOOKS AT THE REMOTE NAMED ORIGIN. | ||
// Install with: gem install github_changelog_generator | ||
notes: { | ||
command: 'github_changelog_generator --no-author --unreleased-only --compare-link' | ||
}, | ||
checkoutRemoteReleaseBranch: { | ||
// this makes a local branch based on the prior prompt, such as release_{TIMESTAMP} | ||
// then update tags from remote in order to prevent duplicate tags | ||
command: function() { | ||
grunt.config('release.localBranch', 'release_' + new Date().getTime() ); | ||
var command = [ | ||
'git checkout -b ' + grunt.config('release.localBranch') + ' ' + | ||
grunt.config('release.remoteRepository') + '/' + grunt.config('release.remoteBaseBranch'), | ||
'git fetch ' + grunt.config('release.remoteRepository') + ' --tag' | ||
].join(' && '); | ||
grunt.log.write('Checking out new local branch based on ' + grunt.config('release.remoteBaseBranch') + ': ' + command); | ||
return command; | ||
} | ||
}, | ||
addReleaseFiles: { | ||
command: function() { | ||
var command = 'git add ' + grunt.config('release.files').join(' '); | ||
grunt.log.write('Staging: ' + command); | ||
return command; | ||
} | ||
}, | ||
commit: { | ||
command: function() { | ||
var command = 'git commit -m "release ' + grunt.config('pkg.version') + '"'; | ||
grunt.log.write('Committing: ' + command); | ||
return command; | ||
} | ||
}, | ||
tag: { | ||
command: function() { | ||
var command = 'git tag -a "' + getPackageVersion() + '" -m "' + getPackageVersion() + '"'; | ||
grunt.log.write('Tagging: ' + command); | ||
return command; | ||
} | ||
}, | ||
pushLocalBranchToUpstream: { | ||
command: function() { | ||
var command = 'git push ' + grunt.config('release.remoteRepository') + ' ' + | ||
grunt.config('release.localBranch') + ':' + grunt.config('release.remoteDestinationBranch'); | ||
grunt.log.write('Pushing: ' + command); | ||
return command; | ||
} | ||
}, | ||
pushTagToUpstream: { | ||
command: function() { | ||
var command = 'git push ' + grunt.config('release.remoteRepository') + ' ' + getPackageVersion(); | ||
grunt.log.write('Publishing tag: ' + command); | ||
return command; | ||
} | ||
}, | ||
pushLocalBranchToUpstreamMaster: { | ||
command: function() { | ||
var command = 'git push ' + grunt.config('release.remoteRepository') + ' ' + | ||
grunt.config('release.localBranch') + ':master'; | ||
grunt.log.write(command); | ||
return command; | ||
} | ||
}, | ||
uploadToCDN: { | ||
command: function() { | ||
function createUploadCommand(version) { | ||
return ['mv dist ' + version, | ||
'scp -i ~/.ssh/fuelcdn -r "' + version + '"/ ' + | ||
'<%= cdnLoginFile.user %>' + '@' + '<%= cdnLoginFile.server %>' + ':' + '<%= cdnLoginFile.folder %>', | ||
'mv "' + version + '" dist', | ||
'echo "Done uploading files."'].join(' && '); | ||
} | ||
var command = [ | ||
getPackageVersion(), | ||
semver.major(getPackageVersion()) + '.' + semver.minor(getPackageVersion()), | ||
semver.major(getPackageVersion()) | ||
].map(createUploadCommand).join(' && '); | ||
grunt.log.write('Uploading: ' + command); | ||
grunt.log.writeln(''); | ||
return command; | ||
} | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
report: 'min' | ||
}, | ||
fuelux: { | ||
options: { | ||
banner: '<%= banner %>' | ||
}, | ||
src: 'dist/js/<%= pkg.name %>.js', | ||
dest: 'dist/js/<%= pkg.name %>.min.js' | ||
} | ||
}, | ||
usebanner: { | ||
dist: { | ||
options: { | ||
position: 'top', | ||
banner: '<%= banner %>' | ||
}, | ||
files: { | ||
src: [ | ||
'dist/css/<%= pkg.name %>.css', | ||
'dist/css/<%= pkg.name %>.min.css' | ||
] | ||
} | ||
} | ||
}, | ||
watch: { | ||
//watch everything and test everything (test dist) | ||
full: { | ||
files: ['Gruntfile.js', 'fonts/**', 'js/**', 'less/**', 'test/**', 'index.html', 'dev.html'], | ||
options: { | ||
livereload: isLivereloadEnabled | ||
}, | ||
tasks: ['jshint', 'blanket_qunit:source', 'qunit:noMoment', 'qunit:globals', 'dist', 'qunit:dist', 'htmllint'] | ||
}, | ||
//watch everything but only perform source qunit tests (don't test dist) | ||
source: { | ||
files: ['Gruntfile.js', 'fonts/**', 'js/**', 'less/**', 'test/**', 'index.html', 'dev.html'], | ||
options: { | ||
livereload: isLivereloadEnabled | ||
}, | ||
tasks: ['jshint', 'connect:testServer', 'blanket_qunit:source', 'qunit:noMoment', 'qunit:globals', 'htmllint'] | ||
}, | ||
//only watch and dist less, useful when doing LESS/CSS work | ||
less: { | ||
files: ['fonts/**', 'less/**'], | ||
options: { | ||
livereload: isLivereloadEnabled | ||
}, | ||
tasks: ['distcss'] | ||
}, | ||
cssdev: { | ||
files: ['Gruntfile.js', 'less/**', 'index.html', 'index-dev.html', 'dev.html', '!less/fuelux-no-namespace.less'], | ||
options: { | ||
livereload: isLivereloadEnabled | ||
}, | ||
tasks: ['distcssdev'] | ||
}, | ||
//watch things that need compiled, useful for debugging/developing against dist | ||
dist: { | ||
files: ['fonts/**', 'js/**', 'less/**'], | ||
options: { | ||
livereload: isLivereloadEnabled | ||
}, | ||
tasks: ['dist'] | ||
}, | ||
//just keep the server running, best for when you are just in the zone slinging code and don't want to be interrupted with tests | ||
lite: { | ||
files: [], | ||
options: { | ||
livereload: isLivereloadEnabled | ||
}, | ||
tasks: [] | ||
} | ||
}), | ||
connectTestServerOptionsPort: connectTestServerOptionsPort, | ||
} | ||
}); | ||
// Look ma! Load all grunt plugins in one line from package.json | ||
require('load-grunt-tasks')(grunt, { | ||
scope: 'devDependencies' | ||
}); | ||
/* ------------- | ||
BUILD | ||
------------- */ | ||
// JS distribution task | ||
grunt.registerTask('distjs', 'concat, uglify', ['concat', 'uglify', 'jsbeautifier']); | ||
// CSS distribution task | ||
grunt.registerTask('distcss', 'Compile LESS into CSS', ['less:dist', 'less:minify', 'usebanner']); | ||
// CSS distribution task (dev) | ||
grunt.registerTask('distcssdev', 'Compile LESS into the dev CSS', [ 'less:dev', 'delete-temp-less-file']); | ||
// Temporary LESS file deletion task | ||
grunt.registerTask('delete-temp-less-file', 'Delete the temporary LESS file created during the build process', function () { | ||
var options = { | ||
force: true | ||
}; | ||
grunt.file.delete('less/fuelux-no-namespace.less', options); | ||
}); | ||
// ZIP distribution task | ||
grunt.registerTask('distzip', 'Compress and zip "dist"', ['copy:zipsrc', 'compress', 'clean:zipsrc']); | ||
// create dist/js/npm.js | ||
grunt.registerTask('commonjs', 'Create CommonJS "bundled reference" module in `dist`', function () { | ||
var files = grunt.config.get('concat.fuelux.src'); | ||
var bundledReferenceFile = 'dist/js/npm.js'; | ||
commonJSBundledReferenceModule(grunt, files, bundledReferenceFile); | ||
}); | ||
// Full distribution task | ||
grunt.registerTask('dist', 'Build "dist." Contributors: do not commit "dist."', | ||
['clean:dist', 'distcss', 'copy:fonts', 'distjs', 'commonjs', 'distzip']); | ||
/* ------------- | ||
TESTS | ||
------------- */ | ||
// The default build task | ||
grunt.registerTask('default', 'Run source file tests. Pass --no-resetdist to keep "dist" changes from being wiped out', | ||
['test', 'clean:screenshots', 'resetdist']); | ||
// to be run prior to submitting a PR | ||
grunt.registerTask('test', 'run jshint, qunit source w/ coverage, and validate HTML', | ||
['jshint', 'connect:testServer', 'blanket_qunit:source', 'qunit:noMoment', 'qunit:globals', 'htmllint']); | ||
//If qunit:source is working but qunit:full is breaking, check to see if the dist broke the code. This would be especially useful if we start mangling our code, but, is 99.99% unlikely right now | ||
grunt.registerTask('validate-dist', 'run qunit:source, dist, and then qunit:full', | ||
['connect:testServer', 'qunit:source', 'dist', 'browserify:commonjs', 'qunit:dist']); | ||
// multiple jQuery versions, then run SauceLabs VMs | ||
grunt.registerTask('releasetest', 'run jshint, build dist, all source tests, validation, and qunit on SauceLabs', | ||
['test', 'dist', 'browserify:commonjs', 'qunit:dist', 'saucelabs-qunit:defaultBrowsers']); | ||
// can be run locally instead of through TravisCI, but requires the Fuel UX Saucelabs API key file which is not public at this time. | ||
grunt.registerTask('saucelabs', 'run jshint, and qunit on saucelabs', | ||
['connect:testServer', 'jshint', 'saucelabs-qunit:defaultBrowsers']); | ||
// can be run locally instead of through TravisCI, but requires the FuelUX Saucelabs API key file which is not public at this time. | ||
grunt.registerTask('trickysauce', 'run tests, jshint, and qunit for "tricky browsers" (IE8-11)', | ||
['connect:testServer', 'jshint', 'saucelabs-qunit:trickyBrowsers']); | ||
// Travis CI task. This task no longer uses SauceLabs. Please run 'grunt saucelabs' manually. | ||
grunt.registerTask('travisci', 'Tests to run when in Travis CI environment', | ||
['test', 'dist', 'browserify:commonjs', 'qunit:dist']); | ||
//if you've already accidentally added your files for commit, this will at least unstage them. If you haven't, this will wipe them out. | ||
grunt.registerTask('resetdist', 'resets changes to dist to keep them from being checked in', function () { | ||
//default resetdist to true... basically. | ||
if (typeof grunt.option('resetdist') === "undefined" || grunt.option('resetdist')) { | ||
var exec = require('child_process').exec; | ||
exec('git reset HEAD dist/*'); | ||
exec('git checkout -- dist/*'); | ||
} | ||
}); | ||
/* ------------- | ||
RELEASE | ||
------------- */ | ||
grunt.registerTask('notes', 'Run a ruby gem that will request from Github unreleased pull requests', ['shell:notes']); | ||
// Maintainers: Run prior to a release. Includes SauceLabs VM tests. | ||
grunt.registerTask('release', 'Release a new version, push it and publish it', function() { | ||
if ( typeof grunt.config('sauceLoginFile') === 'undefined' ) { | ||
grunt.log.write('The file SAUCE_API_KEY.yml is needed in order to run tests in SauceLabs.'['red'].bold + | ||
' Please contact another maintainer to obtain this file.'); | ||
} | ||
if ( typeof grunt.config('cdnLoginFile') === 'undefined' ) { | ||
grunt.log.write('The file FUEL_CDN.yml is needed in order to upload the release files to the CDN.'['red'].bold + | ||
' Please contact another maintainer to obtain this file.'); | ||
} | ||
// update local variable to make sure build prompt is using temp branch's package version | ||
grunt.task.run(['prompt:tempbranch', 'shell:checkoutRemoteReleaseBranch', | ||
'prompt:build', 'dorelease']); | ||
}); | ||
// formerally dorelease task | ||
grunt.registerTask('dorelease', '', function () { | ||
grunt.log.writeln(''); | ||
if (!grunt.option('no-tests')) { | ||
grunt.task.run(['releasetest']); //If phantom timeouts happening because of long-running qunit tests, look into setting `resourceTimeout` in phantom: http://phantomjs.org/api/webpage/property/settings.html | ||
// Delete any screenshots that may have happened if it got this far. This isn't foolproof | ||
// because it relies on the phantomjs server/page timeout, which can take longer than this | ||
// grunt task depending on how long saucelabs takes to run... | ||
grunt.task.run('clean:screenshots'); | ||
} | ||
grunt.config('banner', '<%= bannerRelease %>'); | ||
// Run dist again to grab the latest version numbers. Yeah, we're running it twice... ¯\_(ツ)_/¯ | ||
grunt.task.run(['bump-only:' + grunt.config('release.buildSemVerType'), 'replace:readme', 'dist', | ||
'shell:addReleaseFiles', 'prompt:commit', 'prompt:tag', 'prompt:pushLocalBranchToUpstream', | ||
'prompt:pushTagToUpstream', 'prompt:uploadToCDN', 'prompt:pushLocalBranchToUpstreamMaster']); | ||
}); | ||
/* ------------- | ||
SERVE | ||
------------- */ | ||
// default serve task that runs tests and builds and tests dist by default. | ||
grunt.registerTask('serve', 'Test, build, serve files. (~20s)', function () { | ||
var tasks = ['test', 'servedist']; | ||
grunt.task.run(tasks); | ||
}); | ||
// serve task that runs tests and builds and tests dist by default (~20s). | ||
grunt.registerTask('serveslow', 'Serve files. Run all tests. Does not build. (~20s)', function () { | ||
var tasks = ['connect:server', 'test', 'watch:source']; | ||
grunt.task.run(tasks); | ||
}); | ||
//Fastest serve command for freely slinging code (no tests will run by default). | ||
grunt.registerTask('servefast', 'Serve the files (no watch), --test to run minimal tests. (~0s)', function () { | ||
grunt.task.run(['connect:server']); | ||
if (grunt.option('test')) { | ||
grunt.task.run(['connect:testServer', 'qunit:source', 'watch:source']); | ||
} else { | ||
grunt.task.run(['watch:lite']); | ||
} | ||
}); | ||
// Fastest serve command when you're working on LESS | ||
grunt.registerTask('serveless', 'Compile LESS and serve the files. pass --tests to run test. (~3s)', function () { | ||
grunt.task.run(['distcss']); | ||
if (grunt.option('test')) { | ||
// add qunit:source as a watch task for watch:less since they want tests | ||
grunt.config.merge({ | ||
watch: { | ||
less: { | ||
tasks: ['qunit:source'] | ||
} | ||
} | ||
}); | ||
grunt.task.run(['qunit:source']); | ||
} | ||
grunt.task.run(['connect:server', 'watch:less']); | ||
}); | ||
// Complies the less files into the -dev versions, does not overwrite the main css files. | ||
grunt.registerTask('servedev', 'Serve the files with no "dist" build or tests. Optional --no-less to also disable compiling less into css.', function() { | ||
if (! grunt.option('no-less') ) { | ||
grunt.task.run(['distcssdev']); | ||
} | ||
grunt.task.run(['connect:server', 'watch:cssdev']); | ||
}); | ||
// same as `grunt serve` but tests default to being off | ||
grunt.registerTask('servedist', 'Compile and serve everything, pass --test to run tests. (~7s)', function () { | ||
grunt.task.run(['dist']); | ||
//start up the servers here so we can run tests if appropriate | ||
grunt.task.run(['connect:server']); | ||
grunt.task.run(['connect:testServer']); | ||
if (grunt.option('test')) { | ||
grunt.task.run(['browserify:commonjs','qunit:dist', 'watch:full']); | ||
} else { | ||
grunt.task.run(['watch:dist']); | ||
} | ||
}); | ||
}; | ||
// load custom build, release, serve, and test tasks from the folder specified | ||
grunt.loadTasks('./grunt/tasks'); | ||
}; |
75
index.js
@@ -49,2 +49,6 @@ define(function (require) { | ||
}); | ||
$('#btnCheckboxGetValue').on('click', function () { | ||
var value = $('#myCustomCheckbox1').checkbox('getValue'); | ||
log(value); | ||
}); | ||
$('#btnCheckboxCheck').on('click', function () { | ||
@@ -783,2 +787,7 @@ $('#myCustomCheckbox1').checkbox('check'); | ||
$('#btnRepeaterLogValue').on('click', function () { | ||
console.log($('#myRepeaterActions').repeater('getValue')); | ||
}); | ||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
@@ -799,2 +808,6 @@ SCHEDULER | ||
}); | ||
$('#btnSchedulerLogStringValue').on('click', function () { | ||
var val = $('#myScheduler').scheduler('getValue'); | ||
log(val); | ||
}); | ||
$('#btnSchedulerSetValue').on('click', function () { | ||
@@ -905,3 +918,4 @@ var newVal = { | ||
decimalMark: ',', | ||
units: ['px'] | ||
units: ['px'], | ||
defaultUnit: 'px' | ||
}); | ||
@@ -954,3 +968,3 @@ | ||
"attr": { | ||
"id": "folder1" | ||
"id": "folder" + guid() | ||
} | ||
@@ -962,3 +976,3 @@ }, | ||
"attr": { | ||
"id": "item1", | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-file" | ||
@@ -971,3 +985,3 @@ } | ||
"attr": { | ||
"id": "folder2" | ||
"id": "folder" + guid() | ||
} | ||
@@ -979,3 +993,3 @@ }, | ||
"attr": { | ||
"id": "item2" | ||
"id": "item" + guid() | ||
} | ||
@@ -987,3 +1001,3 @@ }, | ||
"attr": { | ||
"id": "folder3" | ||
"id": "folder" + guid() | ||
} | ||
@@ -995,3 +1009,3 @@ }, | ||
"attr": { | ||
"id": "item3", | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-picture" | ||
@@ -1004,3 +1018,3 @@ } | ||
"attr": { | ||
"id": "folder4" | ||
"id": "folder" + guid() | ||
} | ||
@@ -1012,3 +1026,3 @@ }, | ||
"attr": { | ||
"id": "item4" | ||
"id": "item" + guid() | ||
} | ||
@@ -1025,2 +1039,13 @@ } | ||
function guid() { | ||
function s4() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
} | ||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); | ||
} | ||
// initialize | ||
@@ -1042,3 +1067,3 @@ function myTreeInit() { | ||
"attr": { | ||
"id": "item1", | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-file" | ||
@@ -1051,3 +1076,3 @@ } | ||
"attr": { | ||
"id": "item2" | ||
"id": "item" + guid() | ||
} | ||
@@ -1059,3 +1084,3 @@ }, | ||
"attr": { | ||
"id": "item3", | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-picture" | ||
@@ -1068,3 +1093,3 @@ } | ||
"attr": { | ||
"id": "item4" | ||
"id": "item" + guid() | ||
} | ||
@@ -1087,3 +1112,3 @@ } | ||
"attr": { | ||
"id": "folder1", | ||
"id": "folder" + guid(), | ||
"cssClass": "example-tree-class" | ||
@@ -1096,3 +1121,3 @@ } | ||
"attr": { | ||
"id": "item1", | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-file" | ||
@@ -1105,3 +1130,3 @@ } | ||
"attr": { | ||
"id": "folder2" | ||
"id": "folder" + guid() | ||
} | ||
@@ -1113,3 +1138,3 @@ }, | ||
"attr": { | ||
"id": "item2" | ||
"id": "item" + guid() | ||
} | ||
@@ -1121,3 +1146,3 @@ }, | ||
"attr": { | ||
"id": "folder3" | ||
"id": "folder" + guid() | ||
} | ||
@@ -1129,3 +1154,3 @@ }, | ||
"attr": { | ||
"id": "item3", | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-picture" | ||
@@ -1138,3 +1163,3 @@ } | ||
"attr": { | ||
"id": "folder4" | ||
"id": "item" + guid() | ||
} | ||
@@ -1146,3 +1171,3 @@ }, | ||
"attr": { | ||
"id": "item4" | ||
"id": "item" + guid() | ||
} | ||
@@ -1187,2 +1212,10 @@ } | ||
$('#btnTreeGetValue').click(function () { | ||
console.log($('#myTree1').tree('getValue')); | ||
}); | ||
$('#btnTreeValue').click(function () { | ||
console.log($('#myTree1').tree('selectedItems')); | ||
}); | ||
// events | ||
@@ -1189,0 +1222,0 @@ $('#myTree1').on('loaded.fu.tree', function (e) { |
@@ -167,2 +167,3 @@ /* | ||
Checkbox.prototype.getValue = Checkbox.prototype.isChecked; | ||
@@ -169,0 +170,0 @@ // CHECKBOX PLUGIN DEFINITION |
@@ -209,2 +209,3 @@ /* | ||
Combobox.prototype.getValue = Combobox.prototype.selectedItem; | ||
@@ -211,0 +212,0 @@ // COMBOBOX PLUGIN DEFINITION |
@@ -720,4 +720,5 @@ /* | ||
}; | ||
//for control library consistency | ||
Datepicker.prototype.getValue = Datepicker.prototype.getDate; | ||
// DATEPICKER PLUGIN DEFINITION | ||
@@ -724,0 +725,0 @@ |
@@ -696,2 +696,4 @@ /* | ||
Pillbox.prototype.getValue = Pillbox.prototype.items; | ||
// PILLBOX PLUGIN DEFINITION | ||
@@ -698,0 +700,0 @@ |
@@ -35,3 +35,3 @@ /* | ||
var Placard = function (element, options) { | ||
var Placard = function Placard(element, options) { | ||
var self = this; | ||
@@ -41,2 +41,6 @@ this.$element = $(element); | ||
if(this.$element.attr('data-ellipsis') === 'true'){ | ||
this.options.applyEllipsis = true; | ||
} | ||
this.$accept = this.$element.find('.placard-accept'); | ||
@@ -60,2 +64,3 @@ this.$cancel = this.$element.find('.placard-cancel'); | ||
this.$field.on('keydown.fu.placard', $.proxy(this.keyComplete, this)); | ||
this.$element.on('close.fu.placard', $.proxy(this.hide, this)); | ||
this.$accept.on('click.fu.placard', $.proxy(this.complete, this, 'accepted')); | ||
@@ -66,9 +71,31 @@ this.$cancel.on('click.fu.placard', function (e) { | ||
this.ellipsis(); | ||
this.applyEllipsis(); | ||
}; | ||
var _isShown = function _isShown(placard) { | ||
if (placard.$element.hasClass('showing')) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
var _closeOtherPlacards = function _closeOtherPlacards() { | ||
var otherPlacards; | ||
otherPlacards = $(document).find('.placard.showing'); | ||
if (otherPlacards.length > 0) { | ||
if (otherPlacards.data('fu.placard') && otherPlacards.data('fu.placard').options.explicit) { | ||
return false;//failed | ||
} | ||
otherPlacards.placard('externalClickListener', {}, true); | ||
} | ||
return true;//succeeded | ||
}; | ||
Placard.prototype = { | ||
constructor: Placard, | ||
complete: function (action) { | ||
complete: function complete(action) { | ||
var func = this.options[ EVENT_CALLBACK_MAP[action] ]; | ||
@@ -78,4 +105,5 @@ | ||
previousValue: this.previousValue, | ||
value: this.$field.val() | ||
value: this.getValue() | ||
}; | ||
if (func) { | ||
@@ -86,3 +114,3 @@ func(obj); | ||
if (action === 'cancelled' && this.options.revertOnCancel) { | ||
this.$field.val(this.previousValue); | ||
this.setValue(this.previousValue, true); | ||
} | ||
@@ -95,3 +123,3 @@ | ||
keyComplete: function (e) { | ||
keyComplete: function keyComplete(e) { | ||
if (this.isInput && e.keyCode === 13) { | ||
@@ -106,3 +134,3 @@ this.complete('accepted'); | ||
destroy: function () { | ||
destroy: function destroy() { | ||
this.$element.remove(); | ||
@@ -121,3 +149,3 @@ // remove any external bindings | ||
disable: function () { | ||
disable: function disable() { | ||
this.$element.addClass('disabled'); | ||
@@ -128,13 +156,14 @@ this.$field.attr('disabled', 'disabled'); | ||
ellipsis: function () { | ||
applyEllipsis: function applyEllipsis() { | ||
var field, i, str; | ||
if (this.$element.attr('data-ellipsis') === 'true') { | ||
if (this.options.applyEllipsis) { | ||
field = this.$field.get(0); | ||
if (this.$field.is('input')) { | ||
field.scrollLeft = 0; | ||
//TODO: apply ellipsis to input field overflow | ||
} else { | ||
field.scrollTop = 0; | ||
if (field.clientHeight < field.scrollHeight) { | ||
this.actualValue = this.$field.val(); | ||
this.$field.val(''); | ||
this.actualValue = this.getValue(); | ||
this.setValue('', true); | ||
str = ''; | ||
@@ -144,7 +173,7 @@ i = 0; | ||
str += this.actualValue[i]; | ||
this.$field.val(str + '...'); | ||
this.setValue(str + '...', true); | ||
i++; | ||
} | ||
str = (str.length > 0) ? str.substring(0, str.length - 1) : ''; | ||
this.$field.val(str + '...'); | ||
this.setValue(str + '...', true); | ||
} | ||
@@ -157,3 +186,3 @@ | ||
enable: function () { | ||
enable: function enable() { | ||
this.$element.removeClass('disabled'); | ||
@@ -163,3 +192,3 @@ this.$field.removeAttr('disabled'); | ||
externalClickListener: function (e, force) { | ||
externalClickListener: function externalClickListener(e, force) { | ||
if (force === true || this.isExternalClick(e)) { | ||
@@ -170,3 +199,3 @@ this.complete(this.options.externalClickAction); | ||
getValue: function () { | ||
getValue: function getValue() { | ||
if (this.actualValue !== null) { | ||
@@ -179,3 +208,3 @@ return this.actualValue; | ||
hide: function () { | ||
hide: function hide() { | ||
if (!this.$element.hasClass('showing')) { | ||
@@ -186,3 +215,3 @@ return; | ||
this.$element.removeClass('showing'); | ||
this.ellipsis(); | ||
this.applyEllipsis(); | ||
$(document).off('click.fu.placard.externalClick.' + this.clickStamp); | ||
@@ -192,3 +221,3 @@ this.$element.trigger('hidden.fu.placard'); | ||
isExternalClick: function (e) { | ||
isExternalClick: function isExternalClick(e) { | ||
var el = this.$element.get(0); | ||
@@ -213,33 +242,46 @@ var exceptions = this.options.externalClickExceptions || []; | ||
setValue: function (val) { | ||
this.$field.val(val); | ||
if (!this.$element.hasClass('showing')) { | ||
this.ellipsis(); | ||
/** | ||
* setValue() sets the Placard triggering DOM element's display value | ||
* | ||
* @param {String} the value to be displayed | ||
* @param {Boolean} If you want to explicitly suppress the application | ||
* of ellipsis, pass `true`. This would typically only be | ||
* done from internal functions (like `applyEllipsis`) | ||
* that want to avoid circular logic. Otherwise, the | ||
* value of the option applyEllipsis will be used. | ||
* @return {Object} jQuery object representing the DOM element whose | ||
* value was set | ||
*/ | ||
setValue: function setValue(val, suppressEllipsis) { | ||
//if suppressEllipsis is undefined, check placards init settings | ||
if(typeof suppressEllipsis === "undefined"){ | ||
suppressEllipsis = !this.options.applyEllipsis; | ||
} | ||
}, | ||
show: function () { | ||
var other; | ||
this.$field.val(val); | ||
if (this.$element.hasClass('showing')) { | ||
return; | ||
if (!suppressEllipsis && !_isShown) { | ||
this.applyEllipsis(); | ||
} | ||
other = $(document).find('.placard.showing'); | ||
if (other.length > 0) { | ||
if (other.data('fu.placard') && other.data('fu.placard').options.explicit) { | ||
return; | ||
} | ||
return this.$field; | ||
}, | ||
other.placard('externalClickListener', {}, true); | ||
} | ||
show: function show() { | ||
if(_isShown(this)){return;} | ||
if(!_closeOtherPlacards()){return;} | ||
this.previousValue = this.$field.val(); | ||
this.$element.addClass('showing'); | ||
if (this.actualValue !== null) { | ||
this.$field.val(this.actualValue); | ||
this.setValue(this.actualValue); | ||
this.actualValue = null; | ||
} | ||
this.showPlacard(); | ||
}, | ||
showPlacard: function showPlacard() { | ||
this.$element.addClass('showing'); | ||
if (this.$header.length > 0) { | ||
@@ -290,3 +332,4 @@ this.$popup.css('top', '-' + this.$header.outerHeight(true) + 'px'); | ||
explicit: false, | ||
revertOnCancel: -1//negative 1 will check for an '.placard-accept' button. Also can be set to true or false | ||
revertOnCancel: -1,//negative 1 will check for an '.placard-accept' button. Also can be set to true or false | ||
applyEllipsis: false | ||
}; | ||
@@ -293,0 +336,0 @@ |
@@ -166,2 +166,3 @@ /* | ||
Radio.prototype.getValue = Radio.prototype.isChecked; | ||
@@ -168,0 +169,0 @@ // RADIO PLUGIN DEFINITION |
@@ -60,2 +60,4 @@ /* | ||
$.fn.repeater.Constructor.prototype.getValue = $.fn.repeater.Constructor.prototype.list_getSelectedItems; | ||
$.fn.repeater.Constructor.prototype.list_positionHeadings = function () { | ||
@@ -235,3 +237,3 @@ var $wrapper = this.$element.find('.repeater-list-wrapper'); | ||
}; | ||
$.fn.repeater.Constructor.prototype.list_createItemActions = function () { | ||
@@ -340,2 +342,5 @@ var actionsHtml = ''; | ||
} | ||
if (selectedObj.length === 1) { | ||
selectedObj = selectedObj[0]; | ||
} | ||
@@ -342,0 +347,0 @@ if (actionObj.clickAction) { |
@@ -62,3 +62,3 @@ /* | ||
$(document).on('keypress.fu.selectlist', function(e){ | ||
// get the key that was pressed | ||
@@ -73,3 +73,3 @@ var key = String.fromCharCode(e.which); | ||
}); | ||
}); | ||
@@ -233,3 +233,5 @@ }); | ||
Selectlist.prototype.getValue = Selectlist.prototype.selectedItem; | ||
// SELECT PLUGIN DEFINITION | ||
@@ -236,0 +238,0 @@ |
@@ -41,2 +41,4 @@ /* | ||
this.options = $.extend({}, $.fn.spinbox.defaults, options); | ||
this.options.step = this.$element.data('step') || this.options.step; | ||
this.$input = this.$element.find('.spinbox-input'); | ||
@@ -130,2 +132,9 @@ this.$element.on('focusin.fu.spinbox', this.$input, $.proxy(this.changeFlag, this)); | ||
value = (value + '').split('.').join(this.options.decimalMark); | ||
// if set and default unit if not already present, | ||
// and is an allowed unit, then add default unit | ||
if (this.options.defaultUnit !== '' && | ||
this.options.defaultUnit !== value.slice(-Math.abs(this.options.defaultUnit.length)) && | ||
this.isUnitLegal(this.options.defaultUnit)) { | ||
value = value + this.options.defaultUnit; | ||
} | ||
updateField = (updateField || true); | ||
@@ -248,2 +257,6 @@ if (updateField) { | ||
getValue: function getValue() { | ||
return this.value(); | ||
}, | ||
value: function (value) { | ||
@@ -424,3 +437,4 @@ if (value || value === 0) { | ||
units: [], | ||
decimalMark: '.' | ||
decimalMark: '.', | ||
defaultUnit: '' | ||
}; | ||
@@ -427,0 +441,0 @@ |
@@ -200,3 +200,3 @@ /* | ||
singleSelectSyncNodes(this, clicked, selected); | ||
} | ||
} | ||
@@ -437,4 +437,5 @@ // all done with the DOM, now fire events | ||
Tree.prototype.openFolder = Tree.prototype.discloseFolder; | ||
//For library consistency | ||
Tree.prototype.getValue = Tree.prototype.selectedItems; | ||
// PRIVATE FUNCTIONS | ||
@@ -444,3 +445,3 @@ | ||
$element.addClass('tree-selected'); | ||
if ( $element.data('type') === 'item' && $icon.hasClass('fueluxicon-bullet') ) { | ||
if ( $element.data('type') === 'item' && $icon.hasClass('fueluxicon-bullet') ) { | ||
$icon.removeClass('fueluxicon-bullet').addClass('glyphicon-ok'); // make checkmark | ||
@@ -452,3 +453,3 @@ } | ||
$element.removeClass('tree-selected'); | ||
if ( $element.data('type') === 'item' && $icon.hasClass('glyphicon-ok') ) { | ||
if ( $element.data('type') === 'item' && $icon.hasClass('glyphicon-ok') ) { | ||
$icon.removeClass('glyphicon-ok').addClass('fueluxicon-bullet'); // make bullet | ||
@@ -471,3 +472,3 @@ } | ||
selected.eventType = 'deselected'; | ||
} | ||
} | ||
else { | ||
@@ -474,0 +475,0 @@ styleNodeSelected(clicked.$element, clicked.$icon); |
@@ -13,3 +13,3 @@ { | ||
"jquery": "2.x", | ||
"moment": "2.x" | ||
"moment": "^2.10.6" | ||
}, | ||
@@ -44,2 +44,3 @@ "description": "Base Fuel UX styles and controls", | ||
"grunt-zip": "0.x", | ||
"load-grunt-config": "0.x", | ||
"load-grunt-tasks": "3.x", | ||
@@ -87,3 +88,3 @@ "qunitjs": "1.x", | ||
"title": "Fuel UX", | ||
"version": "3.11.1", | ||
"version": "3.11.2", | ||
"volo": { | ||
@@ -90,0 +91,0 @@ "baseDir": "lib", |
@@ -178,2 +178,16 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test("should support getValue alias", function () { | ||
var $element = $(html).find('#CheckboxCheckedEnabled').clone(); | ||
var $input = $element.find('input[type="checkbox"]'); | ||
// initialize checkbox | ||
var $chk = $element.find('label').checkbox(); | ||
// verify alias aliases | ||
equal($chk.checkbox('isChecked'), $chk.checkbox('getValue'), 'getValue alias matches isChecked'); | ||
$chk.checkbox('toggle'); | ||
equal($chk.checkbox('isChecked'), $chk.checkbox('getValue'), 'getValue alias matches isChecked'); | ||
$chk.checkbox('toggle'); | ||
equal($chk.checkbox('isChecked'), $chk.checkbox('getValue'), 'getValue alias matches isChecked'); | ||
}); | ||
test("should trigger checked event when calling check method", function () { | ||
@@ -180,0 +194,0 @@ var $element = $(html).find('#CheckboxUncheckedEnabled').clone(); |
@@ -59,2 +59,20 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test("should return selectedItem", function () { | ||
var $combobox = $(html).find("#MyCombobox").combobox(); | ||
$combobox.combobox('selectByIndex', 0); | ||
var item = $combobox.combobox('selectedItem'); | ||
var expectedItem = { text: 'One', value: 1 }; | ||
deepEqual(item, expectedItem, 'selectedItem returns expected value'); | ||
}); | ||
test("should return selectedItem", function () { | ||
var $combobox = $(html).find("#MyCombobox").combobox(); | ||
$combobox.combobox('selectByIndex', 0); | ||
var item1 = $combobox.combobox('selectedItem'); | ||
var item2 = $combobox.combobox('getValue'); | ||
deepEqual(item1, item2, 'getValue alias matches selectedItem'); | ||
}); | ||
test("should select by index", function () { | ||
@@ -61,0 +79,0 @@ var $combobox = $(html).find("#MyCombobox").combobox(); |
@@ -78,2 +78,28 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test('should handle 2 digit year', function(){ | ||
var $datepicker = $(html).datepicker(); | ||
var $datepickerInput = $datepicker.find('input'); | ||
var parsedAs; | ||
$datepickerInput.val('01/01/68'); | ||
$datepickerInput.trigger('change'); | ||
parsedAs = $datepicker.datepicker('getFormattedDate'); | ||
equal(parsedAs, '01/01/2068', '01/01/68 parsed correctly'); | ||
$datepickerInput.val('1/1/68'); | ||
$datepickerInput.trigger('change'); | ||
parsedAs = $datepicker.datepicker('getFormattedDate'); | ||
equal(parsedAs, '01/01/2068', '1/1/68 parsed correctly'); | ||
$datepickerInput.val('1/1/69'); | ||
$datepickerInput.trigger('change'); | ||
parsedAs = $datepicker.datepicker('getFormattedDate'); | ||
equal(parsedAs, '01/01/1969', '1/1/69 parsed correctly'); | ||
$datepickerInput.val('01/01/69'); | ||
$datepickerInput.trigger('change'); | ||
parsedAs = $datepicker.datepicker('getFormattedDate'); | ||
equal(parsedAs, '01/01/1969', '01/01/69 parsed correctly'); | ||
}); | ||
test('should initialize with null date', function(){ | ||
@@ -98,2 +124,10 @@ var $datepicker = $(html).datepicker({ date: null }); | ||
test('should return date using getValue alias', function(){ | ||
var $datepicker = $(html).datepicker({ date: new Date(1987, 2, 31) }); | ||
var date1 = $datepicker.datepicker('getDate'); | ||
var date2 = $datepicker.datepicker('getValue'); | ||
equal(date1, date2, 'getValue alias matches getDate'); | ||
}); | ||
test('should set new date using setDate method', function(){ | ||
@@ -100,0 +134,0 @@ var $datepicker = $(html).datepicker(); |
@@ -69,2 +69,10 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test('should return date using getValue alias', function(){ | ||
var $datepicker = $(html).datepicker({ date: new Date(1987, 2, 31) }); | ||
var date1 = $datepicker.datepicker('getDate'); | ||
var date2 = $datepicker.datepicker('getValue'); | ||
equal(date1, date2, 'getValue alias matches getDate'); | ||
}); | ||
test('should set new date using setDate method', function(){ | ||
@@ -71,0 +79,0 @@ var $datepicker = $(html).datepicker(); |
@@ -37,2 +37,8 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test('getValue alias should function', function() { | ||
var $pillbox = $(html).find('#MyPillbox').pillbox(); | ||
deepEqual($pillbox.pillbox('items'), $pillbox.pillbox('getValue'), 'getValue aliases items'); | ||
}); | ||
test('Input functionality should behave as designed', function() { | ||
@@ -39,0 +45,0 @@ var $pillbox = $(html).find('#MyPillbox').pillbox(); |
@@ -233,2 +233,16 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test("should support getValue alias", function () { | ||
var $element = $(html).find('#CheckboxCheckedEnabled').clone(); | ||
var $input = $element.find('input[type="checkbox"]'); | ||
// initialize checkbox | ||
var $radio = $element.find('label').radio(); | ||
// verify alias aliases | ||
equal($radio.radio('isChecked'), $radio.radio('getValue'), 'getValue alias matches isChecked'); | ||
$radio.radio('toggle'); | ||
equal($radio.radio('isChecked'), $radio.radio('getValue'), 'getValue alias matches isChecked'); | ||
$radio.checkbox('toggle'); | ||
equal($radio.radio('isChecked'), $radio.radio('getValue'), 'getValue alias matches isChecked'); | ||
}); | ||
test("should trigger checked event when calling check method", function () { | ||
@@ -235,0 +249,0 @@ var $element = $(html).find('#RadioUncheckedEnabled').clone(); |
@@ -328,4 +328,6 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
selected = $repeater.repeater('list_getSelectedItems'); | ||
var getValue = $repeater.repeater('getValue'); | ||
equal(selected.length, 2, 'returned array contains appropriate number of items'); | ||
equal((typeof selected[0].data==='object' && selected[0].element.length>0), true, 'items in returned array contain appropriate object and attributes'); | ||
deepEqual(selected, getValue, 'getValue aliases selected'); | ||
}, 0); | ||
@@ -422,6 +424,6 @@ | ||
function testClickAction(helpers) { | ||
equal((typeof helpers === 'object' && helpers.length > 0), true, 'Items in row were returned after action click'); | ||
equal((typeof helpers === 'object'), true, 'Items in row were returned after action click'); | ||
var count = 0; | ||
for (var k in helpers[0].rowData) { | ||
if (helpers[0].rowData.hasOwnProperty(k)) { | ||
for (var k in helpers.rowData) { | ||
if (helpers.rowData.hasOwnProperty(k)) { | ||
++count; | ||
@@ -428,0 +430,0 @@ } |
@@ -109,2 +109,11 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test("should alias getValue", function () { | ||
var $selectlist = $(html.find('#MySelectlist4').selectlist()); //.selectlist(); | ||
$selectlist.selectlist('selectByValue', 2); | ||
var item1 = $selectlist.selectlist('selectedItem'); | ||
var item2 = $selectlist.selectlist('getValue'); | ||
deepEqual(item1, item2, 'getValue aliases selectedItem'); | ||
}); | ||
test("should select by value with whitespace", function () { | ||
@@ -111,0 +120,0 @@ var $selectlist = $(html).find('#MySelectlist5').selectlist(); |
@@ -31,2 +31,4 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
equal($spinbox.spinbox('value'), $spinbox.spinbox('getValue'), 'getValue aliases value'); | ||
//set number value | ||
@@ -154,2 +156,37 @@ $spinbox.spinbox('value',2); | ||
test("spinbox should add default unit if none is specified", function () { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
units: ['px'], | ||
defaultUnit: 'px' | ||
}); | ||
$spinbox.spinbox('value', 1); | ||
ok($spinbox.spinbox('value') === '1px', 'spinbox returned value with default unit'); | ||
}); | ||
test("spinbox should NOT add default unit if it not allowed", function () { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
units: ['px'], | ||
defaultUnit: 'ouch' | ||
}); | ||
$spinbox.spinbox('value', 1); | ||
ok($spinbox.spinbox('value') === '1', 'spinbox returned value WITHOUT default unit'); | ||
}); | ||
test("spinbox should keep 3 character default unit when incremented", function () { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
units: ['rem', 'px', '%'], | ||
step: 1, // default, but explicit | ||
defaultUnit: 'rem' | ||
}); | ||
$spinbox.spinbox('value', 1); | ||
$spinbox.spinbox('step', true); | ||
ok($spinbox.spinbox('value') === '2rem', 'spinbox returned value with default unit'); | ||
}); | ||
test("spinbox should behave correctly when custom decimalMark is used", function () { | ||
@@ -156,0 +193,0 @@ var $spinbox = $(html).find('#MySpinboxDecimal').spinbox({ |
@@ -188,2 +188,14 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test("getValue alias should function", function() { | ||
var $tree = $(html).find('#MyTree'); | ||
// multiSelect: false is the default | ||
$tree.tree({ | ||
dataSource: this.dataSource | ||
}); | ||
$tree.tree('selectItem', $tree.find('.tree-item:eq(1)')); | ||
deepEqual($tree.tree('selectedItems'), $tree.tree('getValue'), 'getValue aliases selectedItems'); | ||
}); | ||
test("Single item/folder selection works as designed", function () { | ||
@@ -190,0 +202,0 @@ var $tree = $(html).find('#MyTree'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
1753122
193
23392
11
31
Updatedmoment@^2.10.6