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

Wheel dragging #82

Merged
merged 13 commits into from
Jun 11, 2023
1 change: 1 addition & 0 deletions .jsdoc.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"plugins": [],
"recurseDepth": 10,
"opts": {
"private": true,
"recurse": true
},
"source": {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Improving the student experience by alleviating decision-making anxiety. Brought to you by [20/20 Visionaries](./admin/team.md) (CSE 110 SP23 Team 20).

[![Try it out button](./docs/images/try-button.svg)](https://cse110-sp23-group20.github.io/fortune-teller/source/home-page/)
[![Documentation button](./docs/images/docs-button.svg)](https://cse110-sp23-group20.github.io/fortune-teller/JSDOCs/)
[![Team page button](./docs/images/team-page-button.svg)](./admin/team.md)

## Development
Expand Down
74 changes: 74 additions & 0 deletions __tests__/zodiacUnit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
determineDateRangeRight,
determinePairing,
textGenerator,
angleDiff,
} from "../source/Zodiac_compatibility/zodiac-angles.js";

describe("roundAngle Tests", () => {
Expand Down Expand Up @@ -201,3 +202,76 @@ describe("textGenerator Tests", () => {
expect(textGenerator("unknown", "unknown")).toBe("An error has occurred");
});
});

// Generated by ChatGPT, except some of its expectations were wrong.
describe("angleDiff", () => {
test("returns the correct difference when angle > base", () => {
const angle = 120;
const base = 30;
const result = angleDiff(angle, base);
expect(result).toBe(90);
});

test("returns the correct difference when angle < base", () => {
const angle = 30;
const base = 120;
const result = angleDiff(angle, base);
expect(result).toBe(-90);
});

test("returns 0 when angle and base are equal", () => {
const angle = 90;
const base = 90;
const result = angleDiff(angle, base);
expect(result).toBe(0);
});

test("returns the correct difference when angle and base are opposite", () => {
const angle = -170;
const base = 170;
const result = angleDiff(angle, base);
expect(result).toBe(20);
});

test("returns the correct difference when angle and base are negative", () => {
const angle = -30;
const base = -60;
const result = angleDiff(angle, base);
expect(result).toBe(30);
});

test("returns the correct difference when angle and base are positive", () => {
const angle = 200;
const base = 100;
const result = angleDiff(angle, base);
expect(result).toBe(100);
});

test("returns the correct difference when angle is near 180° and base is negative", () => {
const angle = 179;
const base = -179;
const result = angleDiff(angle, base);
expect(result).toBe(-2);
});

test("returns the correct difference when angle is near -180° and base is positive", () => {
const angle = -179;
const base = 179;
const result = angleDiff(angle, base);
expect(result).toBe(2);
});

test("returns the correct difference when angle is near 180° and base is positive", () => {
const angle = 179;
const base = 1;
const result = angleDiff(angle, base);
expect(result).toBe(178);
});

test("returns the correct difference when angle is near -180° and base is negative", () => {
const angle = -179;
const base = -1;
const result = angleDiff(angle, base);
expect(result).toBe(-178);
});
});
25 changes: 25 additions & 0 deletions docs/images/docs-button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions source/FortuneCookie/fortuneCookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ function reset(state) {
}

resetButton.addEventListener("click", () => {
if (prefersReducedMotion()) {
reset("cookie");
return;
}
resetButton.disabled = true;
cookieButton.classList.remove("hide-cookie");
cancelButton.parentElement.classList.add("animating");
Expand Down Expand Up @@ -164,6 +168,14 @@ function fallNewCookie() {
cookieFalling = true;
}

/**
* Determines whether the user has `prefers-reduced-motion` enabled.
* @returns {boolean} Whether to reduce motion.
*/
function prefersReducedMotion() {
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}

/**
* When the user clicks the button, disables it so they cannot click the button
* in quick succession and cause audio issues
Expand All @@ -173,6 +185,10 @@ document.body.addEventListener("click", async function (event) {
if (fortuneButton.disabled) {
return;
}
if (prefersReducedMotion()) {
reset("fortune");
return;
}
document.body.classList.add("dramatic-mode");
cancelButton.parentElement.classList.add("animating");
cancelButton.parentElement.classList.remove("animating-new-cookie");
Expand Down
5 changes: 5 additions & 0 deletions source/FortuneCookie/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ li.audio-dropdown {
background-clip: text;
animation: reveal-text 1s forwards;
}
@media (prefers-reduced-motion) {
.reveal p {
background-position: right;
}
}

@keyframes reveal-text {
from {
Expand Down
3 changes: 0 additions & 3 deletions source/PalmReading/script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const fortune = document.getElementById("fortune-paragraph");
// etc

const heads = [
"Long and straight head line: You possess a logical and analytical mind. You excel in problem-solving and have a practical approach to life.",
"Short head line: You tend to be impulsive and prefer to make decisions based on intuition rather than careful analysis. You may have a quick wit and enjoy spontaneous experiences.",
Expand Down
5 changes: 5 additions & 0 deletions source/PalmReading/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ body {
stroke-width: 1;
transition: opacity 0.5s;
}
@media (prefers-reduced-motion) {
.ecg {
display: none;
}
}
.ecg-active {
opacity: 1;
transition-delay: 3.5s;
Expand Down
101 changes: 16 additions & 85 deletions source/Zodiac_compatibility/data/dataArray.js

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

Loading