Skip to content

Commit

Permalink
+ The finish button now must be the class 'stepy-finish' instead just…
Browse files Browse the repository at this point in the history
… 'finish'.
  • Loading branch information
wbotelhos committed Mar 18, 2013
1 parent 2e24111 commit bb21983
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Expand Up @@ -17,7 +17,8 @@
+ The 'step' class was renamed to 'stepy-step';
+ The '{id}-titles-{index}' was renamed to '{id}-head-{index}';
+ All callbacks now receives the variable `this` as DOM element instead jQuery;
+ The 'current-step' class was renamed to 'stepy-active'.
+ The 'current-step' class was renamed to 'stepy-active';
+ The finish button now must be the class 'stepy-finish' instead just 'finish'.

## Fixes

Expand Down
10 changes: 5 additions & 5 deletions lib/jquery.stepy.js
Expand Up @@ -24,7 +24,7 @@
* <!-- inputs -->
* </fieldset>
*
* <input type="submit" class="finish" />
* <input type="submit" class="stepy-finish" />
* </form>
*
* $('form').stepy();
Expand Down Expand Up @@ -70,7 +70,7 @@



var finish = that.children('.finish');
var finish = that.children('.stepy-finish');

if (self.opt.finishButton) {
if (finish.length) {
Expand Down Expand Up @@ -104,7 +104,7 @@

finish.appendTo(that.find('p:last'));
} else {
$.error(id + ': element with class name "finish" missing!');
$.error(id + ': element with class name "stepy-finish" missing!');
}
}

Expand Down Expand Up @@ -157,7 +157,7 @@
if (next.length) {
next.click();
} else {
var finish = buttons.children('.finish');
var finish = buttons.children('.stepy-finish');

if (finish.length) {
finish.click();
Expand Down Expand Up @@ -259,7 +259,7 @@
steps = that.children('fieldset').css('display', '');

that.children('.stepy-errors').remove();
steps.last().find('.finish').appendTo(steps.last());
steps.last().find('.stepy-finish').appendTo(steps.last());
steps.find('p.stepy-navigator').remove();
});
}, step: function(index) {
Expand Down
16 changes: 10 additions & 6 deletions spec/spec.js
Expand Up @@ -32,7 +32,7 @@ describe('Stepy', function() {
Helper.label({ html: 'Site' }),
Helper.text({ name: 'site' })
]}),
Helper.submit({ value: 'Finish!', class: 'finish' })
Helper.submit({ value: 'Finish!', class: 'stepy-finish' })
]}));
});

Expand Down Expand Up @@ -570,7 +570,11 @@ describe('Stepy', function() {
context('on the last step', function() {
it ('submits the form', function() {
// given
var self = $('form').stepy({ finish: function() { $(this).data('submited', true); } }),
var self = $('form').stepy({
finish: function() {
$(this).data('submited', true);
}
}),
steps = self.children('fieldset'),
evt = $.Event('keypress');

Expand Down Expand Up @@ -630,7 +634,7 @@ describe('Stepy', function() {
steps.eq(1).find('.button-next').click();

// when
steps.eq(2).find('.finish').click();
steps.eq(2).find('.stepy-finish').click();

// then
expect(self.data('called')).toBeTruthy();
Expand Down Expand Up @@ -674,7 +678,7 @@ describe('Stepy', function() {
self.stepy();

// then
expect(step.find('input.finish')).toBeHidden();
expect(step.find('input.stepy-finish')).toBeHidden();
});

context('on the last step becomes active', function() {
Expand All @@ -687,7 +691,7 @@ describe('Stepy', function() {
steps.eq(1).find('.button-next').click();

// then
expect(steps.last().find('input.finish')).toBeVisible();
expect(steps.last().find('input.stepy-finish')).toBeVisible();
});
});
});
Expand Down Expand Up @@ -1105,7 +1109,7 @@ describe('Stepy', function() {
self.stepy('destroy');

// then
expect(steps).toContain('input.finish');
expect(steps).toContain('input.stepy-finish');
});

it ('removes the bind indicator', function() {
Expand Down

0 comments on commit bb21983

Please sign in to comment.