2018-01-21 01:45:17 +01:00
|
|
|
// Copyright 2018 Google Inc. Use of this source code is governed by an
|
|
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
|
|
|
|
@TestOn('node')
|
2018-11-16 00:16:24 +01:00
|
|
|
@Tags(['node'])
|
2018-01-21 01:45:17 +01:00
|
|
|
|
|
|
|
import 'dart:js_util';
|
|
|
|
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
import '../api.dart';
|
|
|
|
import 'utils.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
group("from a parameter", () {
|
|
|
|
test("true is true", () {
|
|
|
|
var value = parseValue<NodeSassBoolean>("true");
|
|
|
|
expect(value, isJSInstanceOf(sass.types.Boolean));
|
|
|
|
expect(value.getValue(), isTrue);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("false is false", () {
|
|
|
|
var value = parseValue<NodeSassBoolean>("false");
|
|
|
|
expect(value, isJSInstanceOf(sass.types.Boolean));
|
|
|
|
expect(value.getValue(), isFalse);
|
|
|
|
});
|
2020-01-17 23:46:10 +01:00
|
|
|
|
|
|
|
test("has a useful .constructor.name", () {
|
|
|
|
expect(parseValue<NodeSassBoolean>("true").constructor.name,
|
|
|
|
equals("SassBoolean"));
|
|
|
|
});
|
2018-01-21 01:45:17 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
group("from a constant", () {
|
|
|
|
test("true is true", () {
|
|
|
|
var value = sass.types.Boolean.TRUE;
|
|
|
|
expect(value, isJSInstanceOf(sass.types.Boolean));
|
|
|
|
expect(value.getValue(), isTrue);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("false is false", () {
|
|
|
|
var value = sass.types.Boolean.FALSE;
|
|
|
|
expect(value, isJSInstanceOf(sass.types.Boolean));
|
|
|
|
expect(value.getValue(), isFalse);
|
|
|
|
});
|
2020-01-17 23:46:10 +01:00
|
|
|
|
|
|
|
test("has a useful .constructor.name", () {
|
|
|
|
expect(sass.types.Boolean.FALSE.constructor.name, equals("SassBoolean"));
|
|
|
|
});
|
2018-01-21 01:45:17 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test("the constructor throws", () {
|
|
|
|
expect(
|
|
|
|
() => callConstructor(sass.types.Boolean, [true]), throwsA(anything));
|
|
|
|
});
|
2020-04-25 01:11:46 +02:00
|
|
|
|
|
|
|
group("the convenience accessor", () {
|
|
|
|
test("sass.TRUE exists", () {
|
|
|
|
expect(sass.TRUE, equals(sass.types.Boolean.TRUE));
|
|
|
|
});
|
|
|
|
|
|
|
|
test("sass.FALSE exists", () {
|
|
|
|
expect(sass.FALSE, equals(sass.types.Boolean.FALSE));
|
|
|
|
});
|
|
|
|
});
|
2018-01-21 01:45:17 +01:00
|
|
|
}
|