Skip to content

Commit b96c452

Browse files
committed
Fixed bug rstaib#56
1 parent bdfa21f commit b96c452

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

build/jQuery.Steps.1.0.5.nupkg

39 Bytes
Binary file not shown.

build/jquery.steps-1.0.5.zip

47 Bytes
Binary file not shown.

build/jquery.steps.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ function insertStep(wizard, options, state, index, step)
599599
// Change data
600600
step = $.extend({}, stepModel, step);
601601
insertStepToCache(wizard, index, step);
602-
if (state.currentIndex >= index)
602+
if (state.currentIndex !== state.stepCount && state.currentIndex >= index)
603603
{
604604
state.currentIndex++;
605605
saveCurrentStateToCookie(wizard, options, state);
@@ -627,6 +627,10 @@ function insertStep(wizard, options, state, index, step)
627627
renderBody(wizard, body, index);
628628
renderTitle(wizard, options, state, header, index);
629629
refreshSteps(wizard, options, state, index);
630+
if (index === state.currentIndex)
631+
{
632+
refreshStepNavigation(wizard, options, state);
633+
}
630634
refreshPagination(wizard, options, state);
631635

632636
return wizard;

build/jquery.steps.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/privates.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ function insertStep(wizard, options, state, index, step)
539539
// Change data
540540
step = $.extend({}, stepModel, step);
541541
insertStepToCache(wizard, index, step);
542-
if (state.currentIndex >= index)
542+
if (state.currentIndex !== state.stepCount && state.currentIndex >= index)
543543
{
544544
state.currentIndex++;
545545
saveCurrentStateToCookie(wizard, options, state);
@@ -567,6 +567,10 @@ function insertStep(wizard, options, state, index, step)
567567
renderBody(wizard, body, index);
568568
renderTitle(wizard, options, state, header, index);
569569
refreshSteps(wizard, options, state, index);
570+
if (index === state.currentIndex)
571+
{
572+
refreshStepNavigation(wizard, options, state);
573+
}
570574
refreshPagination(wizard, options, state);
571575

572576
return wizard;

test/tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ test("uniqueId", 5, function ()
232232
equal(wizardId, "internal", "Valid id after initialization!");
233233

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

0 commit comments

Comments
 (0)