Skip to content

Commit

Permalink
Format code according to Pretteir v2.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarnakken authored and dependabot[bot] committed Jan 19, 2023
1 parent c2120fd commit c78a099
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 65 deletions.
13 changes: 7 additions & 6 deletions client/controllers/showQRCtrl.js
Expand Up @@ -20,12 +20,13 @@ module.exports = [
const cardKey = urlParams.get('cardKey');
const [, , code] = token.split(':');
const link = `${window.location.origin}/auth/login/?token=${token}`;
QRCode.toDataURL(link, { type: 'image/png', width: 1000 }, function (
err,
url
) {
$scope.qrdata = url;
});
QRCode.toDataURL(
link,
{ type: 'image/png', width: 1000 },
function (err, url) {
$scope.qrdata = url;
}
);
socketIOService.listen('qr-opened', function (socketCode) {
if (socketCode === code) {
$scope.$apply(() => {
Expand Down
13 changes: 7 additions & 6 deletions client/login.js
Expand Up @@ -54,12 +54,13 @@ if ('addEventListener' in document) {
};

fetch('/api/qr/open/?code=' + code);
QRCode.toDataURL(url, { type: 'image/png', width: 300 }, function (
err,
url
) {
document.querySelector('[id=qrImg]').setAttribute('src', url);
});
QRCode.toDataURL(
url,
{ type: 'image/png', width: 300 },
function (err, url) {
document.querySelector('[id=qrImg]').setAttribute('src', url);
}
);
}
} catch (e) {
alert('Det skjedde en feil. Prøv på nytt');
Expand Down
88 changes: 45 additions & 43 deletions features/step_definitions/electionSteps.js
Expand Up @@ -14,24 +14,25 @@ by.addLocator(
);

module.exports = function () {
this.Given(/^There is an active "([^"]*)" election$/, async function (
electionType
) {
this.normalElection.active = false;
await this.normalElection.save();
this.stvElection.active = false;
await this.stvElection.save();

if (electionType === ElectionTypes.STV) {
this.election = this.stvElection;
} else if (electionType === ElectionTypes.NORMAL) {
this.election = this.normalElection;
this.Given(
/^There is an active "([^"]*)" election$/,
async function (electionType) {
this.normalElection.active = false;
await this.normalElection.save();
this.stvElection.active = false;
await this.stvElection.save();

if (electionType === ElectionTypes.STV) {
this.election = this.stvElection;
} else if (electionType === ElectionTypes.NORMAL) {
this.election = this.normalElection;
}
this.election.active = true;
await this.election.save();
const driver = browser.driver;
driver.get('http://localhost:3000/');
}
this.election.active = true;
await this.election.save();
const driver = browser.driver;
driver.get('http://localhost:3000/');
});
);

this.Given(/^There is an inactive election$/, async function () {
this.normalElection.active = false;
Expand Down Expand Up @@ -153,24 +154,25 @@ module.exports = function () {
);
});

this.Then(/^I see "([^"]*)" as priority (\d+)$/, function (
alternative,
position
) {
const priorities = element.all(by.sortableListItems('priorities'));
this.Then(
/^I see "([^"]*)" as priority (\d+)$/,
function (alternative, position) {
const priorities = element.all(by.sortableListItems('priorities'));

return expect(
priorities.get(Number(position) - 1).getText()
).to.eventually.contain(alternative.toUpperCase());
});
return expect(
priorities.get(Number(position) - 1).getText()
).to.eventually.contain(alternative.toUpperCase());
}
);

this.Then(/^I have (\d+) alternative on the confirmation ballot$/, function (
count
) {
const priorities = element.all(by.repeater('alternative in priorities'));
this.Then(
/^I have (\d+) alternative on the confirmation ballot$/,
function (count) {
const priorities = element.all(by.repeater('alternative in priorities'));

return expect(priorities.count()).to.eventually.equal(Number(count));
});
return expect(priorities.count()).to.eventually.equal(Number(count));
}
);

this.Then(
/^I see "([^"]*)" as priority (\d+) on the confirmation ballot$/,
Expand All @@ -183,16 +185,16 @@ module.exports = function () {
}
);

this.Then(/^I see "([^"]*)" as priority (\d+) on the receipt$/, function (
alternative,
position
) {
const priorities = element.all(
by.repeater('alternative in vote.priorities')
);
this.Then(
/^I see "([^"]*)" as priority (\d+) on the receipt$/,
function (alternative, position) {
const priorities = element.all(
by.repeater('alternative in vote.priorities')
);

return expect(
priorities.get(Number(position) - 1).getText()
).to.eventually.contain(alternative.toUpperCase());
});
return expect(
priorities.get(Number(position) - 1).getText()
).to.eventually.contain(alternative.toUpperCase());
}
);
};
22 changes: 12 additions & 10 deletions features/support/hooks.js
Expand Up @@ -68,17 +68,19 @@ module.exports = function () {
mongoose.connection.on('connected', () => server(callback));
});

this.registerHandler('AfterStep', (
event,
callback // To make sure all tests run correctly we force
) =>
// waiting for Angular after each step.
this.registerHandler(
'AfterStep',
(
event,
callback // To make sure all tests run correctly we force
) =>
// waiting for Angular after each step.

browser.waitForAngular().then(callback, (err) => {
const message = err.message || err;
if (message.includes('window.angular')) callback();
else callback(err);
})
browser.waitForAngular().then(callback, (err) => {
const message = err.message || err;
if (message.includes('window.angular')) callback();
else callback(err);
})
);

this.registerHandler('AfterFeatures', async (event, callback) => {
Expand Down

0 comments on commit c78a099

Please sign in to comment.