From af06c7a93046f93f2237809ab86cb18a0d8d7430 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Mon, 7 Mar 2016 00:10:11 -0500 Subject: [PATCH] Fixes bug with normalize value returning 100 when total is > 100 --- RELEASE-NOTES.md | 2 ++ src/definitions/modules/progress.js | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 8690f7de5..2cd147bdf 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -59,6 +59,8 @@ -**Table** - More granular variables for controlling style on first column in a `definition table` **Docs** +- **Progress** - Added new examples to progress +- **Progress** - Added all available behaviors with progress - **Form** - Added example of using custom rules with form - **Build Tools** - Added explanation of using SUI with CI, and auto-install in "recipes" section. - **Build Tools** - Added explanation of how to build RTL in "recipes" section diff --git a/src/definitions/modules/progress.js b/src/definitions/modules/progress.js index 0c25e9cb3..aeb08e515 100644 --- a/src/definitions/modules/progress.js +++ b/src/definitions/modules/progress.js @@ -148,7 +148,6 @@ $.fn.progress = function(parameters) { if( module.has.total() ) { startValue = module.get.value(); incrementValue = incrementValue || 1; - newValue = startValue + incrementValue; } else { @@ -221,9 +220,11 @@ $.fn.progress = function(parameters) { module.debug('Value cannot decrement below 0'); return 0; } - if(module.has.total() && value > module.total) { - module.debug('Value cannot increment above total', module.total); - return module.total; + if(module.has.total()) { + if(value > module.total) { + module.debug('Value cannot increment above total', module.total); + return module.total; + } } else if(value > 100 ) { module.debug('Value cannot increment above 100 percent'); @@ -291,7 +292,7 @@ $.fn.progress = function(parameters) { return module.percent || 0; }, value: function() { - return module.value || 0; + return module.nextValue || module.value || 0; }, total: function() { return module.total || false; @@ -309,7 +310,7 @@ $.fn.progress = function(parameters) { is: { complete: function() { - module.is.success() || module.is.warning() || module.is.error(); + return module.is.success() || module.is.warning() || module.is.error(); }, success: function() { return $module.hasClass(className.success);