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

[Color 4] Update tests for Color Level 4 #1846

Merged
merged 11 commits into from
Dec 9, 2022
Merged
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
28 changes: 12 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,8 @@ on:
pull_request:

jobs:
unit_tests_rb:
name: "Unit tests | Ruby"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with: {bundler-cache: true}
- name: Run tests
run: bundle exec rspec tests/

unit_tests_ts:
name: "Unit tests | Typescript"
unit_tests:
name: "Unit tests"
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -59,17 +48,21 @@ jobs:
- run: npm run lint-spec

dart_sass_language:
name: "Language | Dart Sass"
name: "Language | Dart Sass | Dart ${{ matrix.dart_channel }}"
runs-on: ubuntu-latest
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip dart-sass')"

strategy:
matrix:
dart_channel: [stable, dev]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
with: {sdk: "${{ matrix.dart_channel }}"}

- name: Install dart-sass
run: |
Expand Down Expand Up @@ -164,7 +157,10 @@ jobs:
js_api_sass_embedded:
name: "JS API | sass-embedded | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip sass-embedded')"
if: >-
github.event_name != 'pull_request' ||
(!contains(github.event.pull_request.body, 'skip sass-embedded') &&
!contains(github.event.pull_request.body, 'skip dart-sass'))

strategy:
fail-fast: false
Expand Down
15 changes: 0 additions & 15 deletions Gemfile

This file was deleted.

106 changes: 0 additions & 106 deletions Gemfile.lock

This file was deleted.

36 changes: 21 additions & 15 deletions js-api-spec/value/color.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ describe('SassColor', () => {
expect(() => rgb(255, 255, 255, 1)).not.toThrow();
});

it('disallows invalid values', () => {
// TODO(#1828): Update these expectations
it.skip('disallows invalid values', () => {
expect(() => rgb(-1, 0, 0, 0)).toThrow();
expect(() => rgb(0, -1, 0, 0)).toThrow();
expect(() => rgb(0, 0, -1, 0)).toThrow();
Expand All @@ -80,7 +81,8 @@ describe('SassColor', () => {
expect(() => rgb(0, 0, 0, 1.1)).toThrow();
});

it('rounds channels to the nearest integer', () => {
// TODO(#1828): Update these expectations
it.skip('rounds channels to the nearest integer', () => {
expect(rgb(0.1, 50.4, 90.3)).toEqualWithHash(rgb(0, 50, 90));
expect(rgb(-0.1, 50.5, 90.7)).toEqualWithHash(rgb(0, 51, 91));
});
Expand Down Expand Up @@ -178,15 +180,16 @@ describe('SassColor', () => {

it('has HWB channels', () => {
expect(color.hue).toBe(120);
expect(color.whiteness).toBe(24.313725490196077);
expect(color.blackness).toBe(40.3921568627451);
expect(color.whiteness).toBe(24.360000000000003);
expect(color.blackness).toBe(40.36000000000001);
});

it('has an alpha channel', () => {
expect(color.alpha).toBe(1);
});

it('equals the same color', () => {
// TODO(#1828): Update these expectations
it.skip('equals the same color', () => {
expect(color).toEqualWithHash(rgb(62, 152, 62));
expect(color).toEqualWithHash(hsl(120, 42, 42));
expect(color).toEqualWithHash(
Expand Down Expand Up @@ -214,21 +217,22 @@ describe('SassColor', () => {

it('has HSL channels', () => {
expect(color.hue).toBe(120);
expect(color.saturation).toBe(16.078431372549026);
expect(color.saturation).toBe(16.000000000000007);
expect(color.lightness).toBe(50);
});

it('has HWB channels', () => {
expect(color.hue).toBe(120);
expect(color.whiteness).toBe(41.96078431372549);
expect(color.blackness).toBe(41.96078431372548);
expect(color.whiteness).toBe(42);
expect(color.blackness).toBe(42);
});

it('has an alpha channel', () => {
expect(color.alpha).toBe(1);
});

it('equals the same color', () => {
// TODO(#1828): Update these expectations
it.skip('equals the same color', () => {
expect(color).toEqualWithHash(rgb(107, 148, 107));
expect(color).toEqualWithHash(hsl(120, 16.078431372549026, 50));
expect(color).toEqualWithHash(
Expand Down Expand Up @@ -272,7 +276,8 @@ describe('SassColor', () => {
expect(color.change({alpha: 1}).alpha).toBe(1);
});

it('disallows invalid values', () => {
// TODO(#1828): Update these expectations
it.skip('disallows invalid values', () => {
expect(() => color.change({red: -1})).toThrow();
expect(() => color.change({red: 256})).toThrow();
expect(() => color.change({green: -1})).toThrow();
Expand All @@ -283,7 +288,8 @@ describe('SassColor', () => {
expect(() => color.change({alpha: 1.1})).toThrow();
});

it('rounds channels to the nearest integer', () => {
// TODO(#1828): Update these expectations
it.skip('rounds channels to the nearest integer', () => {
expect(
color.change({red: 0.1, green: 50.4, blue: 90.3})
).toEqualWithHash(rgb(0, 50, 90));
Expand Down Expand Up @@ -371,11 +377,11 @@ describe('SassColor', () => {

it('allows valid values', () => {
expect(color.change({whiteness: 0}).whiteness).toBe(0);
expect(color.change({whiteness: 100}).whiteness).toBe(60.0);
expect(color.change({blackness: 0}).blackness).toBe(0);
expect(color.change({blackness: 100}).blackness).toBe(
93.33333333333333
expect(color.change({whiteness: 100}).whiteness).toBe(
60.141509433962256
);
expect(color.change({blackness: 0}).blackness).toBe(0);
expect(color.change({blackness: 100}).blackness).toBe(93.4065934065934);
expect(color.change({alpha: 0}).alpha).toBe(0);
expect(color.change({alpha: 1}).alpha).toBe(1);
});
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion lib-js/compiler.ts → lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class DartCompiler implements Compiler {
throw new Error(`${repoPath} is not a valid Dart Sass repository`);
}
const dartFile = `
// @dart=2.9
import "dart:convert";
import "dart:io";

Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 0 additions & 18 deletions lib/sass_spec.rb

This file was deleted.

6 changes: 0 additions & 6 deletions lib/sass_spec/annotate.rb

This file was deleted.

Loading