Skip to content
Open
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
32 changes: 31 additions & 1 deletion Sprint-3/alarmclock/alarmclock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
function setAlarm() {}
let toStop = null;

const inputTime = document.querySelector("#alarmSet");
const timeRemaining = document.querySelector("#timeRemaining");
function setAlarm() {
timeRemaining.textContent = `Time Remaining: ${Math.floor(
inputTime.value / 60
)
.toString()
.padStart(2, "0")}:${(inputTime.value % 60).toString().padStart(2, "0")}`;

if (toStop !== null) return;

toStop = setInterval(alarmCount, 1000);
}
function alarmCount() {
if (inputTime.value <= 0) {
clearInterval(toStop);

playAlarm();
} else {
inputTime.value--;
updateInput();
}
}

function updateInput() {
const minutes = Math.floor(inputTime.value / 60);
const seconds = inputTime.value % 60;
timeRemaining.textContent = `Time Remaining: ${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
}

// DO NOT EDIT BELOW HERE

Expand Down
4 changes: 2 additions & 2 deletions Sprint-3/alarmclock/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Title here</title>
<title>Alarm clock app</title>
</head>
<body>
<div class="centre">
Expand Down
7 changes: 6 additions & 1 deletion Sprint-3/alarmclock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
"bugs": {
"url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
},
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme"
"homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme",
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1",
"jest": "^30.5.2",
"jest-environment-jsdom": "^30.5.2"
Comment on lines +19 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Jest packages are pinned with ^30.5.2, a version range that does not match a published Jest release. Installing these dependencies will fail; could you verify the versions before adding them?

To "like" or "dislike" this comment, please follow this link

}
}
Loading