Skip to content

Commit

Permalink
Fixed bug #56
Browse files Browse the repository at this point in the history
  • Loading branch information
rstaib committed Apr 27, 2014
1 parent bdfa21f commit b96c452
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
Binary file modified build/jQuery.Steps.1.0.5.nupkg
Binary file not shown.
Binary file modified build/jquery.steps-1.0.5.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion build/jquery.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ function insertStep(wizard, options, state, index, step)
// Change data
step = $.extend({}, stepModel, step);
insertStepToCache(wizard, index, step);
if (state.currentIndex >= index)
if (state.currentIndex !== state.stepCount && state.currentIndex >= index)
{
state.currentIndex++;
saveCurrentStateToCookie(wizard, options, state);
Expand Down Expand Up @@ -627,6 +627,10 @@ function insertStep(wizard, options, state, index, step)
renderBody(wizard, body, index);
renderTitle(wizard, options, state, header, index);
refreshSteps(wizard, options, state, index);
if (index === state.currentIndex)
{
refreshStepNavigation(wizard, options, state);
}
refreshPagination(wizard, options, state);

return wizard;
Expand Down
2 changes: 1 addition & 1 deletion build/jquery.steps.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/privates.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ function insertStep(wizard, options, state, index, step)
// Change data
step = $.extend({}, stepModel, step);
insertStepToCache(wizard, index, step);
if (state.currentIndex >= index)
if (state.currentIndex !== state.stepCount && state.currentIndex >= index)
{
state.currentIndex++;
saveCurrentStateToCookie(wizard, options, state);
Expand Down Expand Up @@ -567,6 +567,10 @@ function insertStep(wizard, options, state, index, step)
renderBody(wizard, body, index);
renderTitle(wizard, options, state, header, index);
refreshSteps(wizard, options, state, index);
if (index === state.currentIndex)
{
refreshStepNavigation(wizard, options, state);
}
refreshPagination(wizard, options, state);

return wizard;
Expand Down
2 changes: 1 addition & 1 deletion test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ test("uniqueId", 5, function ()
equal(wizardId, "internal", "Valid id after initialization!");

wizard.steps("add", { title: "add" });
equal($("#" + wizardId + "-t-0").text(), "1. add", "Valid step id!");
equal($("#" + wizardId + "-t-0").text(), "current step: 1. add", "Valid step id!");
equal($("#" + wizardId + "-h-0").text(), "add", "Valid title id!");
equal($("#" + wizardId + "-p-0").length, 1, "Valid panel id!");

Expand Down

0 comments on commit b96c452

Please sign in to comment.