Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields check regression bugfix #38

Merged
merged 3 commits into from
Nov 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.