Comparing version 3.11.3 to 3.11.4
@@ -33,3 +33,3 @@ Additional details to supplement the brief nature of the README file. | ||
* Request files from [the Fuel UX CDN](http://www.fuelcdn.com/fuelux/3.10.0/) | ||
* Request files from [the Fuel UX CDN](http://www.fuelcdn.com/fuelux/3.11.3/) | ||
* Using [Bower](https://github.com/bower/bower) (ensures you get all the [dependencies](#dependencies)): | ||
@@ -57,3 +57,3 @@ | ||
* Download a .zip archive of the [latest release](http://www.fuelcdn.com/fuelux/3.10.0/fuelux.zip). | ||
* Download a .zip archive of the [latest release](http://www.fuelcdn.com/fuelux/3.11.3/fuelux.zip). | ||
@@ -68,3 +68,3 @@ ## AMD support | ||
paths: { | ||
'fuelux': 'http://www.fuelcdn.com/fuelux/3.10.0/' | ||
'fuelux': 'http://www.fuelcdn.com/fuelux/3.11.3/' | ||
//... | ||
@@ -71,0 +71,0 @@ } |
@@ -219,4 +219,85 @@ module.exports = function (grunt) { | ||
} | ||
}, | ||
'createmilestone': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.createmilestone', | ||
type: 'confirm', | ||
message: 'Have you created a milestone in GitHub for the next version?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.createmilestone'] === false) { | ||
grunt.fail.fatal("Please follow the wiki https://github.com/ExactTarget/fuelux/wiki/How-to-release-a-new-version#how-to-release", 1); | ||
} | ||
} | ||
} | ||
}, | ||
'bumpmilestones': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.bumpmilestones', | ||
type: 'confirm', | ||
message: 'Have you bumped all open tickets to the next version?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.bumpmilestones'] === false) { | ||
grunt.fail.fatal("Please follow the wiki https://github.com/ExactTarget/fuelux/wiki/How-to-release-a-new-version#how-to-release", 1); | ||
} | ||
} | ||
} | ||
}, | ||
'closemilestone': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.closemilestone', | ||
type: 'confirm', | ||
message: 'Have you marked the current release milestone as closed?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.closemilestone'] === false) { | ||
grunt.fail.fatal("Please follow the wiki https://github.com/ExactTarget/fuelux/wiki/How-to-release-a-new-version#how-to-release", 1); | ||
} | ||
} | ||
} | ||
}, | ||
'startrelease': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.startrelease', | ||
type: 'confirm', | ||
message: 'Would you like to start the release?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.startrelease'] === false) { | ||
grunt.fail.fatal("Please follow the wiki https://github.com/ExactTarget/fuelux/wiki/How-to-release-a-new-version#how-to-release", 1); | ||
} | ||
} | ||
} | ||
}, | ||
'generatelogs': { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'release.generatelogs', | ||
type: 'confirm', | ||
message: 'Would you like to generate change logs?' | ||
} | ||
], | ||
then: function (answers, done) { | ||
if (answers['release.startrelease'] === true) { | ||
grunt.task.run(['shell:notes']); | ||
} | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} |
@@ -12,8 +12,16 @@ module.exports = function (grunt) { | ||
replacements: [{ | ||
from: /fuelux\/\d\.\d\.\d/g, | ||
from: /fuelux\/\d{1,2}\.\d{1,2}\.\d{1,2}/g, | ||
to: 'fuelux/' + getPackage().version | ||
}] | ||
}, | ||
packageJs: { | ||
src: ['package.js'], | ||
overwrite: true, | ||
replacements: [{ | ||
from: /version\:\ \'\d{1,2}\.\d{1,2}\.\d{1,2}\'/g, | ||
to: "version: '" + getPackage().version + "'" | ||
}] | ||
} | ||
} | ||
}; | ||
}; |
module.exports = function (grunt) { | ||
var semver = require('semver'); | ||
var originalVersion = grunt.file.readJSON('./package.json').version; | ||
@@ -8,7 +9,10 @@ function getPackage() { | ||
function getGithubToken() { | ||
return grunt.file.exists('./GITHUB_TOKEN.json') ? grunt.file.readJSON('./GITHUB_TOKEN.json').token : ''; | ||
} | ||
return { | ||
// 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' | ||
command: 'github_changelog_generator --no-author --between-tags ' + originalVersion + ',' + getPackage().version + ' --compare-link -t ' + getGithubToken() | ||
}, | ||
@@ -21,5 +25,6 @@ checkoutRemoteReleaseBranch: { | ||
var command = [ | ||
'git fetch --tags ' + grunt.config('release.remoteRepository'), | ||
'git fetch ' + grunt.config('release.remoteRepository'), | ||
'git checkout -b ' + grunt.config('release.localBranch') + ' ' + | ||
grunt.config('release.remoteRepository') + '/' + grunt.config('release.remoteBaseBranch'), | ||
'git fetch ' + grunt.config('release.remoteRepository') + ' --tag' | ||
grunt.config('release.remoteRepository') + '/' + grunt.config('release.remoteBaseBranch') | ||
].join(' && '); | ||
@@ -26,0 +31,0 @@ grunt.log.write('Checking out new local branch based on ' + grunt.config('release.remoteBaseBranch') + ': ' + command); |
@@ -41,4 +41,15 @@ module.exports = function(grunt) { | ||
// update local variable to make sure build prompt is using temp branch's package version | ||
grunt.task.run(['prompt:tempbranch', 'shell:checkoutRemoteReleaseBranch', | ||
'updateRelease', 'prompt:build', 'dorelease']); | ||
grunt.task.run( | ||
[ | ||
'prompt:createmilestone', | ||
'prompt:bumpmilestones', | ||
'prompt:closemilestone', | ||
'prompt:startrelease', | ||
'prompt:tempbranch', | ||
'shell:checkoutRemoteReleaseBranch', | ||
'updateRelease', | ||
'prompt:build', | ||
'dorelease' | ||
] | ||
); | ||
}); | ||
@@ -61,5 +72,5 @@ | ||
// 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', | ||
grunt.task.run(['bump-only:' + grunt.config('release.buildSemVerType'), 'replace:readme', 'replace:packageJs', 'dist', | ||
'shell:addReleaseFiles', 'prompt:commit', 'prompt:tag', 'prompt:pushLocalBranchToUpstream', | ||
'prompt:pushTagToUpstream', 'prompt:uploadToCDN', 'prompt:pushLocalBranchToUpstreamMaster', 'shell:publishToNPM']); | ||
'prompt:pushTagToUpstream', 'prompt:uploadToCDN', 'prompt:pushLocalBranchToUpstreamMaster', 'shell:publishToNPM', 'prompt:generatelogs']); | ||
}); | ||
@@ -69,2 +80,2 @@ | ||
}; | ||
}; |
534
index.js
@@ -60,9 +60,9 @@ define(function (require) { | ||
$('#myCustomCheckbox1').on('changed.fu.checkbox', function(evt, data) { | ||
$('#myCustomCheckbox1').on('changed.fu.checkbox', function (evt, data) { | ||
log('changed', data); | ||
}); | ||
$('#myCustomCheckbox1').on('checked.fu.checkbox', function(evt, data) { | ||
$('#myCustomCheckbox1').on('checked.fu.checkbox', function (evt, data) { | ||
log('checked'); | ||
}); | ||
$('#myCustomCheckbox1').on('unchecked.fu.checkbox', function(evt, data) { | ||
$('#myCustomCheckbox1').on('unchecked.fu.checkbox', function (evt, data) { | ||
log('unchecked'); | ||
@@ -115,7 +115,7 @@ }); | ||
function formatClientTimezone8601() { | ||
function formatClientTimezone8601 () { | ||
var now = new Date(), | ||
tzo = now.getTimezoneOffset() * -1, //invert | ||
tzo = now.getTimezoneOffset() * -1, // invert | ||
dif = tzo >= 0 ? '+' : '-', | ||
pad = function(num) { | ||
pad = function (num) { | ||
var norm = Math.abs(Math.floor(num)); | ||
@@ -186,3 +186,3 @@ return (norm < 10 ? '0' : '') + norm; | ||
// intitialize | ||
function initMyInfiniteScroll1() { | ||
function initMyInfiniteScroll1 () { | ||
$('#myInfiniteScroll1').infinitescroll({ | ||
@@ -281,106 +281,106 @@ dataSource: function (helpers, callback) { | ||
{ | ||
"text": "African cherry orange", | ||
"value": "african cherry orange", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: orange;", | ||
"data-example-attribute": "true" | ||
'text': 'African cherry orange', | ||
'value': 'african cherry orange', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: orange;', | ||
'data-example-attribute': 'true' | ||
}, | ||
"data": { | ||
"flora": true, | ||
"color": "orange" | ||
'data': { | ||
'flora': true, | ||
'color': 'orange' | ||
} | ||
}, | ||
{ | ||
"text": "Bilberry", | ||
"value": "bilberry", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: midnightBlue;", | ||
"data-example-attribute": "true" | ||
'text': 'Bilberry', | ||
'value': 'bilberry', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: midnightBlue;', | ||
'data-example-attribute': 'true' | ||
}, | ||
"data": { | ||
"flora": true, | ||
"color": "blue" | ||
'data': { | ||
'flora': true, | ||
'color': 'blue' | ||
} | ||
}, | ||
{ | ||
"text": "Ceylon gooseberry", | ||
"value": "ceylon gooseberry", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: mediumBlue;", | ||
"data-example-attribute": "true" | ||
'text': 'Ceylon gooseberry', | ||
'value': 'ceylon gooseberry', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: mediumBlue;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Dead Man's Fingers", | ||
"value": "dead man's fingers", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: darkSlateBlue;", | ||
"data-example-attribute": "true" | ||
'text': "Dead Man's Fingers", | ||
'value': "dead man's fingers", | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: darkSlateBlue;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Governor’s Plum", | ||
"value": "governor’s plum", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: darkViolet;", | ||
"data-example-attribute": "true" | ||
'text': 'Governor’s Plum', | ||
'value': 'governor’s plum', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: darkViolet;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Huckleberry", | ||
"value": "huckleberry", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: darkBlue;", | ||
"data-example-attribute": "true" | ||
'text': 'Huckleberry', | ||
'value': 'huckleberry', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: darkBlue;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Jackfruit", | ||
"value": "jackfruit", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: yellow;", | ||
"data-example-attribute": "true" | ||
'text': 'Jackfruit', | ||
'value': 'jackfruit', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: yellow;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Lillypilly", | ||
"value": "lillypilly", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: pink;", | ||
"data-example-attribute": "true" | ||
'text': 'Lillypilly', | ||
'value': 'lillypilly', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: pink;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Soursop", | ||
"value": "soursop", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: beige;", | ||
"data-example-attribute": "true" | ||
'text': 'Soursop', | ||
'value': 'soursop', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: beige;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Thimbleberry", | ||
"value": "thimbleberry", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: Crimson;", | ||
"data-example-attribute": "true" | ||
'text': 'Thimbleberry', | ||
'value': 'thimbleberry', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: Crimson;', | ||
'data-example-attribute': 'true' | ||
} | ||
}, | ||
{ | ||
"text": "Wongi", | ||
"value": "wongi", | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color: red;", | ||
"data-example-attribute": "true" | ||
'text': 'Wongi', | ||
'value': 'wongi', | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color: red;', | ||
'data-example-attribute': 'true' | ||
} | ||
@@ -408,8 +408,8 @@ }, | ||
{ | ||
"text": "item " + newItemCount, | ||
"value": "item" + newItemCount, | ||
"attr": { | ||
"cssClass": "example-pill-class", | ||
"style": "background-color:" + randomBackgroundColor + ";", | ||
"data-example-attribute": "true" | ||
'text': 'item ' + newItemCount, | ||
'value': 'item' + newItemCount, | ||
'attr': { | ||
'cssClass': 'example-pill-class', | ||
'style': 'background-color:' + randomBackgroundColor + ';', | ||
'data-example-attribute': 'true' | ||
} | ||
@@ -471,7 +471,7 @@ }); | ||
$('#myPlacard3').on('accepted.fu.placard', function() { | ||
$('#myPlacard3').on('accepted.fu.placard', function () { | ||
console.log('accepted.fu.placard'); | ||
}); | ||
$('#myPlacard3').on('cancelled.fu.placard', function() { | ||
$('#myPlacard3').on('cancelled.fu.placard', function () { | ||
console.log('cancelled.fu.placard'); | ||
@@ -515,12 +515,12 @@ }); | ||
// intitialize | ||
function initRepeater() { | ||
function initRepeater () { | ||
// simulate network latency | ||
var loadDelays = ['300', '600', '900', '1200']; | ||
var sort = function( data, sortProperty, sortDirection ) { | ||
var sortedData = _.sortBy( data, function( item ) { | ||
return item[ sortProperty ]; | ||
} ); | ||
var sort = function (data, sortProperty, sortDirection) { | ||
var sortedData = _.sortBy(data, function (item) { | ||
return item[sortProperty]; | ||
}); | ||
// sort direction | ||
if ( sortDirection === 'desc' ) { | ||
if (sortDirection === 'desc') { | ||
sortedData = sortedData.reverse(); | ||
@@ -583,3 +583,3 @@ } | ||
resp.items = sort( resp.items, options.sortProperty, options.sortDirection ); | ||
resp.items = sort(resp.items, options.sortProperty, options.sortDirection); | ||
@@ -621,5 +621,5 @@ // call and simulate latency | ||
//if(options.search){ | ||
//resp.items = []; | ||
//} | ||
// if(options.search){ | ||
// resp.items = []; | ||
// } | ||
@@ -688,12 +688,12 @@ // call and simulate latency | ||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | ||
function initRepeaterActions() { | ||
function initRepeaterActions () { | ||
var loadDelays = ['300', '600', '900', '1200']; | ||
var sort = function( data, sortProperty, sortDirection ) { | ||
var sortedData = _.sortBy( data, function( item ) { | ||
return item[ sortProperty ]; | ||
} ); | ||
var sort = function (data, sortProperty, sortDirection) { | ||
var sortedData = _.sortBy(data, function (item) { | ||
return item[sortProperty]; | ||
}); | ||
// sort direction | ||
if ( sortDirection === 'desc' ) { | ||
if (sortDirection === 'desc') { | ||
sortedData = sortedData.reverse(); | ||
@@ -705,3 +705,3 @@ } | ||
function getSampleDataSet(options, callback) { | ||
function getSampleDataSet (options, callback) { | ||
var resp = { | ||
@@ -753,3 +753,3 @@ count: data.repeater.listData.length, | ||
resp.items = sort( resp.items, options.sortProperty, options.sortDirection ); | ||
resp.items = sort(resp.items, options.sortProperty, options.sortDirection); | ||
@@ -761,3 +761,3 @@ // call and simulate latency | ||
}; | ||
} | ||
@@ -770,3 +770,3 @@ // initialize the repeater | ||
list_selectable: 'multi', | ||
list_actions: { | ||
list_actions: { | ||
width: 37, | ||
@@ -785,3 +785,3 @@ items: [ | ||
html: '<span class="glyphicon glyphicon-trash"></span> Delete', | ||
clickAction: function(helpers, callback) { | ||
clickAction: function (helpers, callback) { | ||
console.log('hey it worked'); | ||
@@ -827,8 +827,8 @@ console.log(helpers); | ||
var newVal = { | ||
"startDateTime": "2014-03-31T03:23+02:00", | ||
"timeZone": { | ||
"name": "Namibia Standard Time", | ||
"offset": "+02:00" | ||
'startDateTime': '2014-03-31T03:23+02:00', | ||
'timeZone': { | ||
'name': 'Namibia Standard Time', | ||
'offset': '+02:00' | ||
}, | ||
"recurrencePattern": "FREQ=MONTHLY;INTERVAL=6;BYDAY=WE;BYSETPOS=3;UNTIL=20140919" | ||
'recurrencePattern': 'FREQ=MONTHLY;INTERVAL=6;BYDAY=WE;BYSETPOS=3;UNTIL=20140919' | ||
}; | ||
@@ -935,2 +935,15 @@ log(newVal); | ||
$('#mySpinbox3').spinbox({ | ||
value: 1, | ||
min: 5, | ||
max: 22, | ||
step: 5, | ||
'limitToStep': true | ||
}); | ||
$('#spinboxCreateBtn').on('click', function () { | ||
$('#mySpinbox4').spinbox(); | ||
}); | ||
// events | ||
@@ -969,70 +982,70 @@ $('#mySpinbox1').on('changed.fu.spinbox', function (event, value) { | ||
var treeDataSource = function (parentData, callback) { | ||
log("Opening branch data: ", parentData); | ||
var treeDataSource = function (parentData, callback) { | ||
log('Opening branch data: ', parentData); | ||
setTimeout(function () { | ||
callback({ | ||
data: [ | ||
{ | ||
"name": "Ascending and Descending", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Sky and Water I (with custom icon)", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-file" | ||
} | ||
}, | ||
{ | ||
"name": "Drawing Hands", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Waterfall", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Belvedere", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Relativity (with custom icon)", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-picture" | ||
} | ||
}, | ||
{ | ||
"name": "House of Stairs", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Convex and Concave", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid() | ||
} | ||
setTimeout(function () { | ||
callback({ | ||
data: [ | ||
{ | ||
'name': 'Ascending and Descending', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid() | ||
} | ||
] | ||
}); | ||
}, 400); | ||
} | ||
}, | ||
{ | ||
'name': 'Sky and Water I (with custom icon)', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid(), | ||
'data-icon': 'glyphicon glyphicon-file' | ||
} | ||
}, | ||
{ | ||
'name': 'Drawing Hands', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid() | ||
} | ||
}, | ||
{ | ||
'name': 'Waterfall', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
}, | ||
{ | ||
'name': 'Belvedere', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid() | ||
} | ||
}, | ||
{ | ||
'name': 'Relativity (with custom icon)', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid(), | ||
'data-icon': 'glyphicon glyphicon-picture' | ||
} | ||
}, | ||
{ | ||
'name': 'House of Stairs', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid() | ||
} | ||
}, | ||
{ | ||
'name': 'Convex and Concave', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
} | ||
] | ||
}); | ||
}, 400); | ||
}; | ||
@@ -1047,4 +1060,4 @@ $('#myTree1').tree({ | ||
function guid() { | ||
function s4() { | ||
function guid () { | ||
function s4 () { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
@@ -1058,4 +1071,4 @@ .toString(16) | ||
// initialize | ||
function myTreeInit() { | ||
// initialize | ||
function myTreeInit () { | ||
var callLimit = 200; | ||
@@ -1072,29 +1085,29 @@ var callCount = 0; | ||
{ | ||
"name": "Sky and Water I (with custom icon)", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-file" | ||
'name': 'Sky and Water I (with custom icon)', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid(), | ||
'data-icon': 'glyphicon glyphicon-file' | ||
} | ||
}, | ||
{ | ||
"name": "Waterfall", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid() | ||
'name': 'Waterfall', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Relativity (with custom icon)", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-picture" | ||
'name': 'Relativity (with custom icon)', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid(), | ||
'data-icon': 'glyphicon glyphicon-picture' | ||
} | ||
}, | ||
{ | ||
"name": "Convex and Concave", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid() | ||
'name': 'Convex and Concave', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
@@ -1114,58 +1127,58 @@ } | ||
{ | ||
"name": "Ascending and Descending", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid(), | ||
"cssClass": "example-tree-class" | ||
'name': 'Ascending and Descending', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid(), | ||
'cssClass': 'example-tree-class' | ||
} | ||
}, | ||
{ | ||
"name": "Sky and Water I (with custom icon)", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-file" | ||
'name': 'Sky and Water I (with custom icon)', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid(), | ||
'data-icon': 'glyphicon glyphicon-file' | ||
} | ||
}, | ||
{ | ||
"name": "Drawing Hands", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid() | ||
'name': 'Drawing Hands', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Waterfall", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid() | ||
'name': 'Waterfall', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Belvedere", | ||
"type": "folder", | ||
"attr": { | ||
"id": "folder" + guid() | ||
'name': 'Belvedere', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'folder' + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Relativity (with custom icon)", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid(), | ||
"data-icon": "glyphicon glyphicon-picture" | ||
'name': 'Relativity (with custom icon)', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid(), | ||
'data-icon': 'glyphicon glyphicon-picture' | ||
} | ||
}, | ||
{ | ||
"name": "House of Stairs", | ||
"type": "folder", | ||
"attr": { | ||
"id": "item" + guid() | ||
'name': 'House of Stairs', | ||
'type': 'folder', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
}, | ||
{ | ||
"name": "Convex and Concave", | ||
"type": "item", | ||
"attr": { | ||
"id": "item" + guid() | ||
'name': 'Convex and Concave', | ||
'type': 'item', | ||
'attr': { | ||
'id': 'item' + guid() | ||
} | ||
@@ -1192,3 +1205,3 @@ } | ||
$('#btnTreeClearSelected').click(function () { | ||
log('Items/folders cleared: ', $('#myTree1').tree('deselectAll') ); | ||
log('Items/folders cleared: ', $('#myTree1').tree('deselectAll')); | ||
}); | ||
@@ -1272,12 +1285,12 @@ | ||
$('#mypicker').on('accepted.fu.picker', function() { | ||
$('#mypicker').on('accepted.fu.picker', function () { | ||
console.log('accepted.fu.picker'); | ||
}); | ||
$('#mypicker').on('cancelled.fu.picker', function() { | ||
$('#mypicker').on('cancelled.fu.picker', function () { | ||
console.log('cancelled.fu.picker'); | ||
}); | ||
$('#mypicker').on('exited.fu.picker', function() { | ||
$('#mypicker').on('exited.fu.picker', function () { | ||
console.log('exited.fu.picker'); | ||
}); | ||
$('#mypicker').on('shown.fu.picker', function() { | ||
$('#mypicker').on('shown.fu.picker', function () { | ||
console.log('shown.fu.picker'); | ||
@@ -1306,20 +1319,20 @@ }); | ||
var emailSetupSamplePane = '<div class="bg-warning alert">' + | ||
' <h4>Setup Message</h4>' + | ||
' <p>Soko radicchio bunya nuts gram dulse silver beet parsnip napa cabbage ' + | ||
' lotus root sea lettuce brussels sprout cabbage. Catsear cauliflower garbanzo yarrow ' + | ||
' salsify chicory garlic bell pepper napa cabbage lettuce tomato kale arugula melon ' + | ||
' sierra leone bologi rutabaga tigernut. Sea lettuce gumbo grape kale kombu cauliflower ' + | ||
' salsify kohlrabi okra sea lettuce broccoli celery lotus root carrot winter purslane ' + | ||
' turnip greens garlic. Jacama garlic courgette coriander radicchio plantain scallion ' + | ||
' cauliflower fava bean desert raisin spring onion chicory bunya nuts. Sea lettuce water ' + | ||
' spinach gram fava bean leek dandelion silver beet eggplant bush tomato. </p>' + | ||
' <p>Pea horseradish azuki bean lettuce avocado asparagus okra. ' + | ||
' Kohlrabi radish okra azuki bean corn fava bean mustard tigernut jacama green bean ' + | ||
' celtuce collard greens avocado quandong fennel gumbo black-eyed pea. Grape silver ' + | ||
' beet watercress potato tigernut corn groundnut. Chickweed okra pea winter ' + | ||
' purslane coriander yarrow sweet pepper radish garlic brussels sprout groundnut ' + | ||
' summer purslane earthnut pea tomato spring onion azuki bean gourd. Gumbo kakadu ' + | ||
' plum komatsuna black-eyed pea green bean zucchini gourd winter purslane silver ' + | ||
' beet rock melon radish asparagus spinach. </p>' + | ||
'</div>'; | ||
' <h4>Setup Message</h4>' + | ||
' <p>Soko radicchio bunya nuts gram dulse silver beet parsnip napa cabbage ' + | ||
' lotus root sea lettuce brussels sprout cabbage. Catsear cauliflower garbanzo yarrow ' + | ||
' salsify chicory garlic bell pepper napa cabbage lettuce tomato kale arugula melon ' + | ||
' sierra leone bologi rutabaga tigernut. Sea lettuce gumbo grape kale kombu cauliflower ' + | ||
' salsify kohlrabi okra sea lettuce broccoli celery lotus root carrot winter purslane ' + | ||
' turnip greens garlic. Jacama garlic courgette coriander radicchio plantain scallion ' + | ||
' cauliflower fava bean desert raisin spring onion chicory bunya nuts. Sea lettuce water ' + | ||
' spinach gram fava bean leek dandelion silver beet eggplant bush tomato. </p>' + | ||
' <p>Pea horseradish azuki bean lettuce avocado asparagus okra. ' + | ||
' Kohlrabi radish okra azuki bean corn fava bean mustard tigernut jacama green bean ' + | ||
' celtuce collard greens avocado quandong fennel gumbo black-eyed pea. Grape silver ' + | ||
' beet watercress potato tigernut corn groundnut. Chickweed okra pea winter ' + | ||
' purslane coriander yarrow sweet pepper radish garlic brussels sprout groundnut ' + | ||
' summer purslane earthnut pea tomato spring onion azuki bean gourd. Gumbo kakadu ' + | ||
' plum komatsuna black-eyed pea green bean zucchini gourd winter purslane silver ' + | ||
' beet rock melon radish asparagus spinach. </p>' + | ||
'</div>'; | ||
@@ -1344,3 +1357,3 @@ // sample method buttons | ||
var item = $('#myWizard').wizard('selectedItem', { | ||
step: "distep" | ||
step: 'distep' | ||
}); | ||
@@ -1387,1 +1400,2 @@ log(item); | ||
}); | ||
@@ -153,3 +153,2 @@ /* | ||
field.scrollLeft = 0; | ||
//TODO: apply ellipsis to input field overflow | ||
} else { | ||
@@ -156,0 +155,0 @@ field.scrollTop = 0; |
@@ -81,7 +81,9 @@ /* | ||
'value': 1, | ||
'min': 1 | ||
'min': 1, | ||
'limitToStep': true | ||
}); | ||
} else { | ||
this.$repeatIntervalSpinbox.spinbox({ | ||
'min': 1 | ||
'min': 1, | ||
'limitToStep': true | ||
}); | ||
@@ -92,3 +94,4 @@ } | ||
'value': 1, | ||
'min': 1 | ||
'min': 1, | ||
'limitToStep': true | ||
}); | ||
@@ -95,0 +98,0 @@ this.$endDate.datepicker(this.options.endDateOptions); |
@@ -34,3 +34,3 @@ /* | ||
var Spinbox = function (element, options) { | ||
var Spinbox = function Spinbox(element, options) { | ||
this.$element = $(element); | ||
@@ -44,5 +44,10 @@ this.$element.find('.btn').on('click', function (e) { | ||
if (this.options.value < this.options.min) { | ||
this.options.value = this.options.min; | ||
} else if (this.options.max < this.options.value) { | ||
this.options.value = this.options.max; | ||
} | ||
this.$input = this.$element.find('.spinbox-input'); | ||
this.$element.on('focusin.fu.spinbox', this.$input, $.proxy(this.changeFlag, this)); | ||
this.$element.on('focusout.fu.spinbox', this.$input, $.proxy(this.change, this)); | ||
this.$input.on('focusout.fu.spinbox', this.$input, $.proxy(this.change, this)); | ||
this.$element.on('keydown.fu.spinbox', this.$input, $.proxy(this.keydown, this)); | ||
@@ -85,2 +90,5 @@ this.$element.on('keyup.fu.spinbox', this.$input, $.proxy(this.keyup, this)); | ||
this.options.defaultUnit = _isUnitLegal(this.options.defaultUnit, this.options.units) ? this.options.defaultUnit : ''; | ||
this.unit = this.options.defaultUnit; | ||
this.lastValue = this.options.value; | ||
@@ -95,6 +103,61 @@ | ||
// Truly private methods | ||
var _limitToStep = function _limitToStep(number, step) { | ||
return Math.round(number / step) * step; | ||
}; | ||
var _isUnitLegal = function _isUnitLegal(unit, validUnits) { | ||
var legalUnit = false; | ||
var suspectUnit = unit.toLowerCase(); | ||
$.each(validUnits, function (i, validUnit) { | ||
validUnit = validUnit.toLowerCase(); | ||
if (suspectUnit === validUnit) { | ||
legalUnit = true; | ||
return false;//break out of the loop | ||
} | ||
}); | ||
return legalUnit; | ||
}; | ||
var _applyLimits = function _applyLimits(value) { | ||
// if unreadable | ||
if (isNaN(parseFloat(value))) { | ||
return value; | ||
} | ||
// if not within range return the limit | ||
if (value > this.options.max) { | ||
if (this.options.cycle) { | ||
value = this.options.min; | ||
} else { | ||
value = this.options.max; | ||
} | ||
} else if (value < this.options.min) { | ||
if (this.options.cycle) { | ||
value = this.options.max; | ||
} else { | ||
value = this.options.min; | ||
} | ||
} | ||
if (this.options.limitToStep && this.options.step) { | ||
value = _limitToStep(value, this.options.step); | ||
//force round direction so that it stays within bounds | ||
if(value > this.options.max){ | ||
value = value - this.options.step; | ||
} else if(value < this.options.min) { | ||
value = value + this.options.step; | ||
} | ||
} | ||
return value; | ||
}; | ||
Spinbox.prototype = { | ||
constructor: Spinbox, | ||
destroy: function () { | ||
destroy: function destroy() { | ||
this.$element.remove(); | ||
@@ -113,68 +176,13 @@ // any external bindings | ||
render: function () { | ||
var inputValue = this.parseInput(this.$input.val()); | ||
var maxUnitLength = ''; | ||
// if input is empty and option value is default, 0 | ||
if (inputValue !== '' && this.options.value === 0) { | ||
this.value(inputValue); | ||
} else { | ||
this.output (this.options.value); | ||
} | ||
if (this.options.units.length) { | ||
$.each(this.options.units, function (index, value) { | ||
if (value.length > maxUnitLength.length) { | ||
maxUnitLength = value; | ||
} | ||
}); | ||
} | ||
render: function render() { | ||
this.setValue(this.getDisplayValue()); | ||
}, | ||
output: function (value, updateField) { | ||
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); | ||
if (updateField) { | ||
this.$input.val(value); | ||
} | ||
change: function change() { | ||
this.setValue(this.getDisplayValue()); | ||
return value; | ||
}, | ||
parseInput: function (value) { | ||
value = (value + '').split(this.options.decimalMark).join('.'); | ||
return value; | ||
}, | ||
change: function () { | ||
var newVal = this.parseInput(this.$input.val()) || ''; | ||
if (this.options.units.length || this.options.decimalMark !== '.') { | ||
newVal = this.parseValueWithUnit(newVal); | ||
} else if (newVal / 1) { | ||
newVal = this.options.value = this.checkMaxMin(newVal / 1); | ||
} else { | ||
newVal = this.checkMaxMin(newVal.replace(/[^0-9.-]/g, '') || ''); | ||
this.options.value = newVal / 1; | ||
} | ||
this.output (newVal); | ||
this.changeFlag = false; | ||
this.triggerChangedEvent(); | ||
}, | ||
changeFlag: function () { | ||
this.changeFlag = true; | ||
}, | ||
stopSpin: function () { | ||
stopSpin: function stopSpin() { | ||
if (this.switches.timeout !== undefined) { | ||
@@ -187,4 +195,4 @@ clearTimeout(this.switches.timeout); | ||
triggerChangedEvent: function () { | ||
var currentValue = this.value(); | ||
triggerChangedEvent: function triggerChangedEvent() { | ||
var currentValue = this.getValue(); | ||
if (currentValue === this.lastValue) return; | ||
@@ -194,6 +202,6 @@ this.lastValue = currentValue; | ||
// Primary changed event | ||
this.$element.trigger('changed.fu.spinbox', this.output(currentValue, false));// no DOM update | ||
this.$element.trigger('changed.fu.spinbox', currentValue); | ||
}, | ||
startSpin: function (type) { | ||
startSpin: function startSpin(type) { | ||
if (!this.options.disabled) { | ||
@@ -220,3 +228,3 @@ var divisor = this.switches.count; | ||
iterate: function (type) { | ||
iterate: function iterate(type) { | ||
this.step(type); | ||
@@ -226,112 +234,105 @@ this.startSpin(type); | ||
step: function (isIncrease) { | ||
// isIncrease: true is up, false is down | ||
step: function step(isIncrease) { | ||
//refresh value from display before trying to increment in case they have just been typing before clicking the nubbins | ||
this.setValue(this.getDisplayValue()); | ||
var newVal; | ||
var digits, multiple, currentValue, limitValue; | ||
// trigger change event | ||
if (this.changeFlag) { | ||
this.change(); | ||
if (isIncrease) { | ||
newVal = this.options.value + this.options.step; | ||
} else { | ||
newVal = this.options.value - this.options.step; | ||
} | ||
// get current value and min/max options | ||
currentValue = this.options.value; | ||
limitValue = isIncrease ? this.options.max : this.options.min; | ||
newVal = newVal.toFixed(5); | ||
if ( (isIncrease ? currentValue < limitValue : currentValue > limitValue) ) { | ||
var newVal = currentValue + (isIncrease ? 1 : -1) * this.options.step; | ||
this.setValue(newVal + this.unit); | ||
}, | ||
// raise to power of 10 x number of decimal places, then round | ||
if (this.options.step % 1 !== 0) { | ||
digits = (this.options.step + '').split('.')[1].length; | ||
multiple = Math.pow(10, digits); | ||
newVal = Math.round(newVal * multiple) / multiple; | ||
} | ||
getDisplayValue: function getDisplayValue() { | ||
var inputValue = this.parseInput(this.$input.val()); | ||
var value = (!!inputValue) ? inputValue : this.options.value; | ||
return value; | ||
}, | ||
// if outside limits, set to limit value | ||
if (isIncrease ? newVal > limitValue : newVal < limitValue) { | ||
this.value(limitValue); | ||
} else { | ||
this.value(newVal); | ||
} | ||
} else if (this.options.cycle) { | ||
var cycleVal = isIncrease ? this.options.min : this.options.max; | ||
this.value(cycleVal); | ||
} | ||
setDisplayValue: function setDisplayValue(value) { | ||
this.$input.val(value); | ||
}, | ||
getValue: function getValue() { | ||
return this.value(); | ||
var val = this.options.value; | ||
if (this.options.decimalMark !== '.'){ | ||
val = (val + '').split('.').join(this.options.decimalMark); | ||
} | ||
return val + this.unit; | ||
}, | ||
value: function (value) { | ||
if (value || value === 0) { | ||
if (this.options.units.length || this.options.decimalMark !== '.') { | ||
this.output(this.parseValueWithUnit(value + (this.unit || ''))); | ||
return this; | ||
setValue: function setValue(val) { | ||
//remove any i18n on the number | ||
if (this.options.decimalMark !== '.') { | ||
val = this.parseInput(val); | ||
} | ||
} else if (!isNaN(parseFloat(value)) && isFinite(value)) { | ||
this.options.value = value / 1; | ||
this.output (value + (this.unit ? this.unit : '')); | ||
return this; | ||
//are we dealing with united numbers? | ||
if(typeof val !== "number"){ | ||
var potentialUnit = val.replace(/[0-9.-]/g, ''); | ||
//make sure unit is valid, or else drop it in favor of current unit, or default unit (potentially nothing) | ||
this.unit = _isUnitLegal(potentialUnit, this.options.units) ? potentialUnit : this.options.defaultUnit; | ||
} | ||
} | ||
var intVal = this.getIntValue(val); | ||
} else { | ||
if (this.changeFlag) { | ||
this.change(); | ||
} | ||
//make sure we are dealing with a number | ||
if (isNaN(intVal) && !isFinite(intVal)) { | ||
return this.setValue(this.options.value); | ||
} | ||
if (this.unit) { | ||
return this.options.value + this.unit; | ||
} else { | ||
return this.output(this.options.value, false);// no DOM update | ||
} | ||
//conform | ||
intVal = _applyLimits.call(this, intVal); | ||
//cache the pure int value | ||
this.options.value = intVal; | ||
//prepare number for display | ||
val = intVal + this.unit; | ||
if (this.options.decimalMark !== '.'){ | ||
val = (val + '').split('.').join(this.options.decimalMark); | ||
} | ||
}, | ||
isUnitLegal: function (unit) { | ||
var legalUnit; | ||
//display number | ||
this.setDisplayValue(val); | ||
$.each(this.options.units, function (index, value) { | ||
if (value.toLowerCase() === unit.toLowerCase()) { | ||
legalUnit = unit.toLowerCase(); | ||
return false; | ||
} | ||
}); | ||
return this; | ||
}, | ||
return legalUnit; | ||
value: function value(val) { | ||
if (val || val === 0) { | ||
return this.setValue(val); | ||
} else { | ||
return this.getValue(); | ||
} | ||
}, | ||
// strips units and add them back | ||
parseValueWithUnit: function (value) { | ||
var unit = value.replace(/[^a-zA-Z]/g, ''); | ||
var number = value.replace(/[^0-9.-]/g, ''); | ||
parseInput: function parseInput(value) { | ||
value = (value + '').split(this.options.decimalMark).join('.'); | ||
if (unit) { | ||
unit = this.isUnitLegal(unit); | ||
} | ||
this.options.value = this.checkMaxMin(number / 1); | ||
this.unit = unit || undefined; | ||
return this.options.value + (unit || ''); | ||
return value; | ||
}, | ||
checkMaxMin: function (value) { | ||
// if unreadable | ||
if (isNaN(parseFloat(value))) { | ||
return value; | ||
} | ||
getIntValue: function getIntValue(value) { | ||
//if they didn't pass in a number, try and get the number | ||
value = (typeof value === "undefined") ? this.getValue() : value; | ||
// if there still isn't a number, abort | ||
if(typeof value === "undefined"){return;} | ||
// if not within range return the limit | ||
if (!(value <= this.options.max && value >= this.options.min)) { | ||
value = value >= this.options.max ? this.options.max : this.options.min; | ||
if (typeof value === 'string'){ | ||
value = this.parseInput(value); | ||
} | ||
value = parseFloat(value, 10); | ||
return value; | ||
}, | ||
disable: function () { | ||
disable: function disable() { | ||
this.options.disabled = true; | ||
@@ -343,3 +344,3 @@ this.$element.addClass('disabled'); | ||
enable: function () { | ||
enable: function enable() { | ||
this.options.disabled = false; | ||
@@ -351,3 +352,3 @@ this.$element.removeClass('disabled'); | ||
keydown: function (event) { | ||
keydown: function keydown(event) { | ||
var keyCode = event.keyCode; | ||
@@ -358,6 +359,8 @@ if (keyCode === 38) { | ||
this.step(false); | ||
} else if (keyCode === 13) { | ||
this.change(); | ||
} | ||
}, | ||
keyup: function (event) { | ||
keyup: function keyup(event) { | ||
var keyCode = event.keyCode; | ||
@@ -370,3 +373,3 @@ | ||
bindMousewheelListeners: function () { | ||
bindMousewheelListeners: function bindMousewheelListeners() { | ||
var inputEl = this.$input.get(0); | ||
@@ -384,3 +387,3 @@ if (inputEl.addEventListener) { | ||
mousewheelHandler: function (event) { | ||
mousewheelHandler: function mousewheelHandler(event) { | ||
if (!this.options.disabled) { | ||
@@ -416,3 +419,3 @@ var e = window.event || event;// old IE support | ||
$.fn.spinbox = function (option) { | ||
$.fn.spinbox = function spinbox(option) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
@@ -450,3 +453,4 @@ var methodReturn; | ||
decimalMark: '.', | ||
defaultUnit: '' | ||
defaultUnit: '', | ||
limitToStep: false | ||
}; | ||
@@ -456,3 +460,3 @@ | ||
$.fn.spinbox.noConflict = function () { | ||
$.fn.spinbox.noConflict = function noConflict() { | ||
$.fn.spinbox = old; | ||
@@ -459,0 +463,0 @@ return this; |
@@ -86,3 +86,3 @@ { | ||
"title": "Fuel UX", | ||
"version": "3.11.3", | ||
"version": "3.11.4", | ||
"volo": { | ||
@@ -89,0 +89,0 @@ "baseDir": "lib", |
@@ -37,7 +37,7 @@ #[Fuel UX](http://getfuelux.com/) | ||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="//www.fuelcdn.com/fuelux/3.10.0/css/fuelux.min.css" rel="stylesheet"> | ||
<link href="//www.fuelcdn.com/fuelux/3.11.3/css/fuelux.min.css" rel="stylesheet"> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script> | ||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.1/js/bootstrap.min.js"></script> | ||
<script src="//www.fuelcdn.com/fuelux/3.10.0/js/fuelux.min.js"></script> | ||
<script src="//www.fuelcdn.com/fuelux/3.11.3/js/fuelux.min.js"></script> | ||
@@ -49,3 +49,3 @@ ``` | ||
- Request files from [the Fuel UX CDN](http://www.fuelcdn.com/fuelux/3.10.0/) | ||
- Request files from [the Fuel UX CDN](http://www.fuelcdn.com/fuelux/3.11.3/) | ||
- Install with [NPM](https://www.npmjs.com/package/fuelux): `npm install fuelux`. | ||
@@ -52,0 +52,0 @@ - [Download the latest release](https://github.com/exacttarget/fuelux/archive/3.4.0.zip). |
@@ -105,2 +105,53 @@ /*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ | ||
test("spinbox should not allow maximum/minimum values to be surpassed by default values", function () { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
min: 1, | ||
value: 0 | ||
}); | ||
equal($spinbox.spinbox('value'), 1, 'spinbox inits to min when default value is less than min'); | ||
$spinbox = $(html).find('#MySpinbox').spinbox({ | ||
max: 1, | ||
value: 2 | ||
}); | ||
equal($spinbox.spinbox('value'), 1, 'spinbox inits to max when default value is more than min'); | ||
}); | ||
test("spinbox should not allow non-step values to be surpassed by manual input when increments are limited to step", function () { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
step: 3, | ||
limitToStep: true, | ||
min: 1, | ||
max: 7 | ||
}); | ||
$spinbox.find('.spinbox-input').val(1); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), 3, 'spinbox sets to step value when min value is less than step value and value is set by hand'); | ||
$spinbox.find('.spinbox-input').val(4); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), 3, 'spinbox rounds down to step when appropriate'); | ||
$spinbox.find('.spinbox-input').val(5); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), 6, 'spinbox rounds up to step when appropriate'); | ||
$spinbox.find('.spinbox-input').val(7); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), 6, 'spinbox sets to step value when value is max value and is not multiple of step value and value is set by hand'); | ||
$spinbox.find('.spinbox-input').val(-10000000000); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), 3, 'spinbox sets to step value when min value is less than step value and value is set by hand'); | ||
$spinbox.find('.spinbox-input').val(9999999999999); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), 6, 'spinbox sets to step value when value is max value and is not multiple of step value and value is set by hand'); | ||
}); | ||
test("should cycle when min or max values are reached", function () { | ||
@@ -112,2 +163,3 @@ var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
}); | ||
$spinbox.spinbox('step',true); // 2 | ||
@@ -124,3 +176,3 @@ $spinbox.spinbox('step',true); // 3 | ||
test("spinbox should behave correctly when units are included", function () { | ||
test("spinbox should behave correctly when units are included", function testForUnits() { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
@@ -131,26 +183,20 @@ min: -10, | ||
//spinbox behaves when units are enabled for non-unit values | ||
$spinbox.spinbox('value', 1); | ||
ok($spinbox.spinbox('value') === '1', 'spinbox returned integer'); | ||
ok($spinbox.spinbox('value') === '1', 'spinbox does not add units when units are enabled but not present in input; 1 === ' + $spinbox.spinbox('value')); | ||
//spinbox handles string with appropriate unit | ||
$spinbox.spinbox('value', '1px'); | ||
ok($spinbox.spinbox('value') === '1px', 'spinbox returned string and supported units'); | ||
ok($spinbox.spinbox('value') === '1px', 'spinbox handles string with allowed unit; 1px === ' + $spinbox.spinbox('value')); | ||
//increment positive | ||
$spinbox.spinbox('step',true); | ||
equal($spinbox.spinbox('value'), '2px', 'spinbox increments positive'); | ||
$spinbox.spinbox('step', true); | ||
equal($spinbox.spinbox('value'), '2px', 'spinbox increments; ' + $spinbox.spinbox('value') + ' === 2px'); | ||
//increment nagative | ||
$spinbox.spinbox('step',false); | ||
equal($spinbox.spinbox('value'), '1px', 'spinbox increments negative'); | ||
$spinbox.spinbox('step', false); | ||
equal($spinbox.spinbox('value'), '1px', 'spinbox decrements; ' + $spinbox.spinbox('value') + ' === 1px'); | ||
//Should not allow units not supported | ||
$spinbox.spinbox('value','2pp'); | ||
equal($spinbox.spinbox('value'), 2, 'spinbox not allowing units not supported'); | ||
$spinbox.spinbox('value', '2pp'); | ||
equal($spinbox.spinbox('value'), 2, 'spinbox does not allow unsupported units; 2 === ' + $spinbox.spinbox('value')); | ||
//Spinbox should change on focusout with units | ||
$spinbox.find('.spinbox-input').val('4px'); | ||
$spinbox.find('.spinbox-input').focusout(); | ||
equal($spinbox.spinbox('value'), '4px', 'spinbox updates string value on focus out'); | ||
equal($spinbox.spinbox('value'), '4px', 'spinbox updates string value on focus out with units present; 4px === ' + $spinbox.spinbox('value')); | ||
@@ -170,3 +216,3 @@ }); | ||
test("spinbox should NOT add default unit if it not allowed", function () { | ||
test("spinbox should NOT add default unit if it is not an allowed unit", function () { | ||
var $spinbox = $(html).find('#MySpinbox').spinbox({ | ||
@@ -178,3 +224,3 @@ units: ['px'], | ||
$spinbox.spinbox('value', 1); | ||
ok($spinbox.spinbox('value') === '1', 'spinbox returned value WITHOUT default unit'); | ||
ok($spinbox.spinbox('value') === '1', 'spinbox returned value WITHOUT default unit; ' + $spinbox.spinbox('value') + ' === 1'); | ||
@@ -205,16 +251,46 @@ }); | ||
//spinbox behaves when there is no custom decimal mark | ||
$spinbox.spinbox('value', '1'); | ||
equal($spinbox.spinbox('value'), '1', 'spinbox returned correct number'); | ||
equal($spinbox.spinbox('value'), '1', 'spinbox returned expected number when there is was custom decimal mark; ' + $spinbox.spinbox('value') + ' === 1'); | ||
//increment positive | ||
$spinbox.spinbox('step',true); | ||
equal($spinbox.spinbox('value'), '1,1', 'spinbox increments positive'); | ||
equal($spinbox.spinbox('value'), '1,1', 'spinbox increments; ' + $spinbox.spinbox('value') + ' === 1,1'); | ||
//increment nagative | ||
$spinbox.spinbox('step',false); | ||
equal($spinbox.spinbox('value'), '1', 'spinbox increments negative'); | ||
equal($spinbox.spinbox('value'), '1', 'spinbox decrements; ' + $spinbox.spinbox('value') + ' === 1'); | ||
}); | ||
test("spinbox should allow retrieval of unadulterated number", function () { | ||
var $spinbox = $(html).find('#MySpinboxDecimal').spinbox({ | ||
value: '1,1', | ||
min: 0, | ||
max: 10, | ||
step: 0.1, | ||
decimalMark: ',' | ||
}); | ||
$spinbox.spinbox('value', '1'); | ||
equal($spinbox.spinbox('getIntValue'), 1, 'spinbox returns expected integer; ' + $spinbox.spinbox('getIntValue') + ' === 1'); | ||
$spinbox.spinbox('value', '1,1'); | ||
equal($spinbox.spinbox('getIntValue'), 1.1, 'spinbox returns expected float; ' + $spinbox.spinbox('value') + ' === 1.1'); | ||
var $spinbox2 = $(html).find('#MySpinboxDecimal').spinbox({ | ||
value: '1.1', | ||
min: 0, | ||
max: 10, | ||
step: 0.1, | ||
decimalMark: '.' | ||
}); | ||
$spinbox.spinbox('value', '1'); | ||
equal($spinbox.spinbox('getIntValue'), 1, 'spinbox returns expected integer; ' + $spinbox.spinbox('getIntValue') + ' === 1'); | ||
$spinbox.spinbox('value', '1.1'); | ||
equal($spinbox.spinbox('getIntValue'), 1.1, 'spinbox returns expected float; ' + $spinbox.spinbox('value') + ' === 1.1'); | ||
}); | ||
test("should destroy control", function () { | ||
@@ -221,0 +297,0 @@ var $el = $(html).find('#MySpinbox'); |
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 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
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
1816362
198
24477