Skip to content

Commit

Permalink
Merge pull request #38 from timekit-io/fields-check-regression
Browse files Browse the repository at this point in the history
Fields check regression bugfix
  • Loading branch information
laander committed Nov 28, 2015
2 parents 448c833 + 95330e1 commit fd5d712
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ function TimekitBooking() {
rootTarget.removeClass('bookingjs-small');
}

if (config.bookingFields.comment.enabled === true) { height += 84; }
if (config.bookingFields.phone.enabled === true) { height += 48; }
if (config.bookingFields.voip.enabled === true) { height += 48; }
if (config.bookingFields.location.enabled === true) { height += 48; }
if (config.bookingFields.comment.enabled) { height += 84; }
if (config.bookingFields.phone.enabled) { height += 48; }
if (config.bookingFields.voip.enabled) { height += 48; }
if (config.bookingFields.location.enabled) { height += 48; }

return {
height: height,
Expand Down Expand Up @@ -347,10 +347,10 @@ function TimekitBooking() {
participants: [config.email, data.email]
};

if (data.location.enabled) { args.where = data.location; }
if (data.phone.enabled) { args.description += 'Phone: ' + data.phone + '\n'; }
if (data.voip.enabled) { args.description += 'VoIP: ' + data.voip + '\n'; }
if (data.comment.enabled) { args.description += 'Comment: ' + data.comment + '\n'; }
if (config.bookingFields.location.enabled) { args.where = data.location; }
if (config.bookingFields.phone.enabled) { args.description += config.bookingFields.phone.placeholder + ': ' + data.phone + '\n'; }
if (config.bookingFields.voip.enabled) { args.description += config.bookingFields.voip.placeholder + ': ' + data.voip + '\n'; }
if (config.bookingFields.comment.enabled) { args.description += config.bookingFields.comment.placeholder + ': ' + data.comment + '\n'; }

$.extend(true, args, config.timekitCreateEvent);

Expand Down
65 changes: 65 additions & 0 deletions test/basicInteractions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,69 @@ describe('Basic interaction', function() {

});

it('should be able to close the booking page', function(done) {

createWidget();

setTimeout(function() {

interact.clickEvent();

setTimeout(function() {

expect($('.bookingjs-bookpage')).toBeInDOM();
expect($('.bookingjs-bookpage')).toBeVisible();

$('.bookingjs-bookpage-close').click();

setTimeout(function() {

expect($('.bookingjs-bookpage').length).toBe(0);

done();

}, 500);
}, 500);
}, 500);

});

it('should be able to book an event', function(done) {

createWidget();

setTimeout(function() {

interact.clickEvent();

setTimeout(function() {

var name = 'Joe Test';
var email = 'test@timekit.io';
var comment = 'This is a test';

$('.input-name').val(name);
$('.input-email').val(email);
$('.input-comment').val(comment);
$('.bookingjs-form-button').click();

expect($('.bookingjs-form').hasClass('loading')).toBe(true);

setTimeout(function() {

expect($('.bookingjs-form').hasClass('success')).toBe(true);
expect($('.bookingjs-form-success-message')).toBeVisible();

var successMessage = $('.bookingjs-form-success-message').html();
var contains = successMessage.indexOf(email) > -1;
expect(contains).toBe(true);

done();

}, 200);
}, 500);
}, 500);

});

});
9 changes: 9 additions & 0 deletions test/utils/mockAjax.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd5d712

Please sign in to comment.