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

Add JS API tests for calculations #1918

Merged
merged 23 commits into from
Jul 19, 2023
Merged

Add JS API tests for calculations #1918

merged 23 commits into from
Jul 19, 2023

Conversation

jerivas
Copy link
Contributor

@jerivas jerivas commented Jun 7, 2023

[skip dart-sass]
[skip sass-embedded]

sass/sass#3622
sass/dart-sass#1988
sass/embedded-host-node#237

@jerivas
Copy link
Contributor Author

jerivas commented Jun 12, 2023

@jerivas jerivas marked this pull request as ready for review July 6, 2023 20:51
js-api-spec/function.test.ts Outdated Show resolved Hide resolved
js-api-spec/function.test.ts Outdated Show resolved Hide resolved
@jerivas jerivas requested a review from nex3 July 17, 2023 19:07
js-api-spec/function.test.ts Outdated Show resolved Hide resolved
js-api-spec/value/calculation.test.ts Outdated Show resolved Hide resolved
js-api-spec/function.test.ts Outdated Show resolved Hide resolved
js-api-spec/value/calculation.test.ts Outdated Show resolved Hide resolved
@jerivas jerivas requested a review from nex3 July 18, 2023 17:42
Comment on lines +10 to +12
CalculationOperation,
CalculationOperator,
CalculationInterpolation,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we prefix these with Sass? E.g. SassCalculationOperation

Copy link
Contributor

Choose a reason for hiding this comment

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

@nex3 Any comments?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's necessary—they're fairly unlikely to conflict. The reason we prefix the value types is that some of them conflict with built-in JS classes like Number and String. But since these don't, and they aren't Value subtypes so they don't need to follow the same naming convention, I think leaving them unprefixed is fine.

Comment on lines +45 to +53
it("isn't any other type", () => {
expect(() => calculation.assertBoolean()).toThrow();
expect(() => calculation.assertColor()).toThrow();
expect(() => calculation.assertFunction()).toThrow();
expect(() => calculation.assertMap()).toThrow();
expect(calculation.tryMap()).toBe(null);
expect(() => calculation.assertNumber()).toThrow();
expect(() => calculation.assertString()).toThrow();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add assertCalculation() to the "isn't any other type" tests for all the other types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I did on 17c55ef, unless I missed something?

Copy link
Contributor Author

@jerivas jerivas Jul 19, 2023

Choose a reason for hiding this comment

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

Oh, but they were missing from the dart test suite. I added them in oddbird/dart-sass@6b3b5b8 and oddbird/dart-sass@52ab266

@nex3 nex3 merged commit e6e6762 into sass:main Jul 19, 2023
@jerivas jerivas deleted the js-api-calculations branch July 20, 2023 16:47
@nex3 nex3 mentioned this pull request Dec 5, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants