Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Introduce logical property handling (sass) #34

Merged
merged 17 commits into from
Nov 13, 2019

Conversation

davidcmoulton
Copy link
Member

No description provided.

@@ -1,9 +1,14 @@
@use "font";
@use "vendor/sass-rem/rem" as sass-rem with (
$rem-baseline: font.$size,
$rem-fallback: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

Now the default, so don't need to provide it as an argument.

Removing the namespace to avoid test files being littered with test.describe, test.assert... etc. as it's clear what these are and they don't need encapsulating.
@davidcmoulton davidcmoulton marked this pull request as ready for review November 12, 2019 09:53
@davidcmoulton davidcmoulton requested a review from a team as a code owner November 12, 2019 09:53
);

@forward "vendor/sass-rem/rem";
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this for?

Copy link
Member Author

Choose a reason for hiding this comment

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

Left over code, not needed now we're wrapping what we use from sass-rem. Will remove.


@if type-of($arguments) == "list" and length($arguments) > 1 {

@include validation.expect-at-most($arguments, 2, "More than two arguments supplied with 'inline' dimension") {
Copy link
Contributor

Choose a reason for hiding this comment

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

@include expect.at-most( reads quite nicely. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

It reads well, but am slightly wary of introducing that as there's already an expect mixin provided by the test framework. Similar argument against assert.at-most which I also considered. Do you think validate.expect-at-most improves on what's currently there?

@@ -1,17 +1,17 @@
@use "test" as *;
@use "../../src/shared-styles/validation" with ( $is-test: true);
@use "../../src/shared-styles/logical-properties";
@use "../../src/shared-styles/logical";
Copy link
Member Author

Choose a reason for hiding this comment

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

logical seems a reasonable filename / namespace, from https://caniuse.com/#search=logical it doesn't look like it would cause a conceptual clash with anything else. Allows for use as logical.property which reads well.

@@ -0,0 +1,33 @@
$is-test: false !default;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should maybe call this capture-errors, or, maybe better: throw-errors.


}


Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 63 to 89
@include output {
@include validation.expect-at-most((1, 2, 3), 2) {
--dev: "null";
}
}

@include expect {
_error: "Expected at most 2 values";
}
}

}

@include it("does not error when passed no more than the specficied threshold number of values") {

@include assert() {

@include output {
@include validation.expect-at-most((1, 2, 3), 3) {
--dev: "null";
}
}

@include expect {
--dev: "null";
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Some indentation problems here.

Comment on lines 3 to 13
@function error($message, $capture: $is-test) {
@if $capture {
@return $message;
}

@error $message;
}

@mixin error($message) {
_error: error($message);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe these should be their own module?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried that but I couldn't work out how to pass in $is-test with with, as error is then @used by validation which needs to provide a different $is-test value depending on the calling context. Might just be a sass modules learning point, but going to leave it for now until a clear pattern emerges.

Copy link
Member Author

Choose a reason for hiding this comment

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

UPDATE: Got it working in #35.

Copy link
Contributor

@thewilkybarkid thewilkybarkid left a comment

Choose a reason for hiding this comment

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

Couple of minor comments, but looks good!

@davidcmoulton davidcmoulton merged commit 3a649af into libero:master Nov 13, 2019
@davidcmoulton davidcmoulton deleted the logical-properties branch November 13, 2019 15:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants