Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

Commit

Permalink
Turns on single quote in tslint. Closes #89.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscox committed Mar 31, 2017
1 parent 3b5da40 commit 265852a
Show file tree
Hide file tree
Showing 39 changed files with 459 additions and 459 deletions.
32 changes: 16 additions & 16 deletions src/core/Remixer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* under the License.
*/

import { CSS, KeyCode, KeyEvent } from "../lib/Constants";
import { LocalStorage } from "../lib/LocalStorage";
import { Messaging } from "../lib/Messaging";
import { Remote } from "../lib/Remote";
import { BooleanVariable } from "./variables/BooleanVariable";
import { ColorVariable } from "./variables/ColorVariable";
import { NumberVariable } from "./variables/NumberVariable";
import { IRangeVariableParams, RangeVariable } from "./variables/RangeVariable";
import { StringVariable } from "./variables/StringVariable";
import { IVariableCallback, IVariableKeyMap, Variable } from "./variables/Variable";
import { CSS, KeyCode, KeyEvent } from '../lib/Constants';
import { LocalStorage } from '../lib/LocalStorage';
import { Messaging } from '../lib/Messaging';
import { Remote } from '../lib/Remote';
import { BooleanVariable } from './variables/BooleanVariable';
import { ColorVariable } from './variables/ColorVariable';
import { NumberVariable } from './variables/NumberVariable';
import { IRangeVariableParams, RangeVariable } from './variables/RangeVariable';
import { StringVariable } from './variables/StringVariable';
import { IVariableCallback, IVariableKeyMap, Variable } from './variables/Variable';

import "../ui/styles/iframe.less";
import '../ui/styles/iframe.less';

/**
* A declaration used for the webpack `html-loader` module to load string
Expand Down Expand Up @@ -55,7 +55,7 @@ class Remixer {
* @return {Remixer} The attached instance of Remixer.
*/
static get attachedInstance(): Remixer {
const parentRemixer = window.parent["remixer"];
const parentRemixer = window.parent['remixer'];
if (parentRemixer) {
return parentRemixer._sharedInstance as Remixer;
}
Expand All @@ -80,14 +80,14 @@ class Remixer {
*/
private appendFrameToBody(): void {
if (!this._frameElement) {
const frame = document.createElement("IFRAME") as HTMLFrameElement;
const frame = document.createElement('IFRAME') as HTMLFrameElement;
frame.id = CSS.RMX_OVERLAY_FRAME;
frame.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
document.getElementsByTagName("body")[0].appendChild(frame);
frame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-popups');
document.getElementsByTagName('body')[0].appendChild(frame);

// Until `srcdoc` is fully compatible with all browsers, lets simply
// write the overlay html content to the iframe content window.
const iframeContent: string = require("../ui/templates/overlay_iframe.html");
const iframeContent: string = require('../ui/templates/overlay_iframe.html');
frame.contentWindow.document.open();
frame.contentWindow.document.write(iframeContent);
frame.contentWindow.document.close();
Expand Down
36 changes: 18 additions & 18 deletions src/core/__tests__/BooleanVariable_test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as chai from "chai";
import * as sinon from "sinon";
import * as sinonChai from "sinon-chai";
import * as chai from 'chai';
import * as sinon from 'sinon';
import * as sinonChai from 'sinon-chai';

import { ConstraintType, ControlType, DataType } from "../../lib/Constants";
import { remixer } from "../Remixer";
import { BooleanVariable } from "../variables/BooleanVariable";
import { Variable } from "../variables/Variable";
import { ConstraintType, ControlType, DataType } from '../../lib/Constants';
import { remixer } from '../Remixer';
import { BooleanVariable } from '../variables/BooleanVariable';
import { Variable } from '../variables/Variable';

const expect = chai.expect;
chai.use(sinonChai);

describe("BooleanVariable", () => {
const key: string = "test variable";
const sanitizedKey: string = "test_variable";
describe('BooleanVariable', () => {
const key: string = 'test variable';
const sanitizedKey: string = 'test_variable';
const initialValue: boolean = true;
let callbackSpy: sinon.SinonSpy;
let variable: BooleanVariable;
Expand All @@ -22,31 +22,31 @@ describe("BooleanVariable", () => {
variable = remixer.addBooleanVariable(key, initialValue, callbackSpy);
});

it("should create a new variable", () => {
it('should create a new variable', () => {
expect(variable).to.be.instanceof(Variable).and.instanceof(BooleanVariable);
});

it("have the correct datatype", () => {
it('have the correct datatype', () => {
expect(variable.dataType).to.equal(DataType.BOOLEAN);
});

it("have the correct contraintType", () => {
it('have the correct contraintType', () => {
expect(variable.constraintType).to.equal(ConstraintType.NONE);
});

it("have the correct controlType", () => {
it('have the correct controlType', () => {
expect(variable.controlType).to.equal(ControlType.SWITCH);
});

it("have the correct title", () => {
it('have the correct title', () => {
expect(variable.title).to.equal(key);
});

it("have the correct sanitized key", () => {
it('have the correct sanitized key', () => {
expect(variable.key).to.equal(sanitizedKey);
});

it("should trigger callback when selected value of variable changes", () => {
it('should trigger callback when selected value of variable changes', () => {
const newValue = !variable.selectedValue;
variable.selectedValue = newValue;

Expand All @@ -55,7 +55,7 @@ describe("BooleanVariable", () => {
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
it('should clone properly', () => {
const clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
Expand Down
54 changes: 27 additions & 27 deletions src/core/__tests__/ColorVariable_test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import * as chai from "chai";
import * as sinon from "sinon";
import * as sinonChai from "sinon-chai";
import * as chai from 'chai';
import * as sinon from 'sinon';
import * as sinonChai from 'sinon-chai';

import { ColorUtils } from "../../lib/ColorUtils";
import { ConstraintType, ControlType, DataType } from "../../lib/Constants";
import { remixer } from "../Remixer";
import { ColorVariable } from "../variables/ColorVariable";
import { Variable } from "../variables/Variable";
import { ColorUtils } from '../../lib/ColorUtils';
import { ConstraintType, ControlType, DataType } from '../../lib/Constants';
import { remixer } from '../Remixer';
import { ColorVariable } from '../variables/ColorVariable';
import { Variable } from '../variables/Variable';

const expect = chai.expect;
chai.use(sinonChai);

describe("ColorVariable", () => {
const key: string = "test variable";
const sanitizedKey: string = "test_variable";
const initialValue: string = "#4285F4";
const limitedToValues: string[] = ["#4285F4", "#0F9D58", "#DB4437"];
describe('ColorVariable', () => {
const key: string = 'test variable';
const sanitizedKey: string = 'test_variable';
const initialValue: string = '#4285F4';
const limitedToValues: string[] = ['#4285F4', '#0F9D58', '#DB4437'];
let callbackSpy: sinon.SinonSpy;
let variable: ColorVariable;

Expand All @@ -29,62 +29,62 @@ describe("ColorVariable", () => {
);
});

it("should create a new variable", () => {
it('should create a new variable', () => {
expect(variable).to.be.instanceof(Variable).and.instanceof(ColorVariable);
});

it("have the correct datatype", () => {
it('have the correct datatype', () => {
expect(variable.dataType).to.equal(DataType.COLOR);
});

it("have the correct contraintType", () => {
it('have the correct contraintType', () => {
expect(variable.constraintType).to.equal(ConstraintType.LIST);

variable.limitedToValues = [];
expect(variable.constraintType).to.equal(ConstraintType.NONE);
});

it("have the correct controlType", () => {
it('have the correct controlType', () => {
expect(variable.controlType).to.equal(ControlType.COLOR_LIST);
});

it("should have correct controlType based on number of allowed values", () => {
it('should have correct controlType based on number of allowed values', () => {
// List control.
expect(variable.controlType).to.equal(ControlType.COLOR_LIST);

// Input control.
const var1 = remixer.addColorVariable("test_key", "#4285F4");
const var1 = remixer.addColorVariable('test_key', '#4285F4');
expect(var1.controlType).to.equal(ControlType.COLOR_INPUT);
});

it("have the correct title", () => {
it('have the correct title', () => {
expect(variable.title).to.equal(key);
});

it("have the correct sanitized key", () => {
it('have the correct sanitized key', () => {
expect(variable.key).to.equal(sanitizedKey);
});

it("have the correct allowed values", () => {
it('have the correct allowed values', () => {
expect(variable.limitedToValues).to.equal(limitedToValues);
});

it("should trigger callback when selected value of variable changes", () => {
const newValue = "#0F9D58";
it('should trigger callback when selected value of variable changes', () => {
const newValue = '#0F9D58';
variable.selectedValue = newValue;

const updatedVariable = callbackSpy.args[0][0];
expect(callbackSpy).to.have.been.calledOnce.and.calledWith(variable);
expect(updatedVariable.selectedValue.toLowerCase()).to.equal(newValue.toLowerCase());
});

it("should clone properly", () => {
it('should clone properly', () => {
const clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});

it("should return string color value after format", () => {
const color = "rgba(1, 1, 1, 0.8)";
it('should return string color value after format', () => {
const color = 'rgba(1, 1, 1, 0.8)';
const rgbaColor = ColorUtils.toRgba(color);
const formattedColor = variable.formatValue(rgbaColor);

Expand Down
42 changes: 21 additions & 21 deletions src/core/__tests__/NumberVariable_test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as chai from "chai";
import * as sinon from "sinon";
import * as sinonChai from "sinon-chai";
import * as chai from 'chai';
import * as sinon from 'sinon';
import * as sinonChai from 'sinon-chai';

import { ConstraintType, ControlType, DataType } from "../../lib/Constants";
import { remixer } from "../Remixer";
import { NumberVariable } from "../variables/NumberVariable";
import { Variable } from "../variables/Variable";
import { ConstraintType, ControlType, DataType } from '../../lib/Constants';
import { remixer } from '../Remixer';
import { NumberVariable } from '../variables/NumberVariable';
import { Variable } from '../variables/Variable';

const expect = chai.expect;
chai.use(sinonChai);

describe("NumberVariable", () => {
const key: string = "test variable";
const sanitizedKey: string = "test_variable";
describe('NumberVariable', () => {
const key: string = 'test variable';
const sanitizedKey: string = 'test_variable';
const initialValue: number = 20;
const limitedToValues: number[] = [10, 20, 30, 40];
let callbackSpy: sinon.SinonSpy;
Expand All @@ -28,47 +28,47 @@ describe("NumberVariable", () => {
);
});

it("should create a new variable", () => {
it('should create a new variable', () => {
expect(variable).to.be.instanceof(Variable).and.instanceof(NumberVariable);
});

it("have the correct datatype", () => {
it('have the correct datatype', () => {
expect(variable.dataType).to.equal(DataType.NUMBER);
});

it("have the correct contraintType", () => {
it('have the correct contraintType', () => {
expect(variable.constraintType).to.equal(ConstraintType.LIST);

variable.limitedToValues = [];
expect(variable.constraintType).to.equal(ConstraintType.NONE);
});

it("should have correct controlType based on number of allowed values", () => {
it('should have correct controlType based on number of allowed values', () => {
// List control.
expect(variable.controlType).to.equal(ControlType.TEXT_LIST);

// Segmented control.
const var1 = remixer.addNumberVariable("test_key1", 1, [1, 2]);
const var1 = remixer.addNumberVariable('test_key1', 1, [1, 2]);
expect(var1.controlType).to.equal(ControlType.SEGMENTED);

// Text input control.
const var2 = remixer.addNumberVariable("test_key2", 1);
const var2 = remixer.addNumberVariable('test_key2', 1);
expect(var2.controlType).to.equal(ControlType.TEXT_INPUT);
});

it("have the correct title", () => {
it('have the correct title', () => {
expect(variable.title).to.equal(key);
});

it("have the correct sanitized key", () => {
it('have the correct sanitized key', () => {
expect(variable.key).to.equal(sanitizedKey);
});

it("have the correct allowed values", () => {
it('have the correct allowed values', () => {
expect(variable.limitedToValues).to.equal(limitedToValues);
});

it("should trigger callback when selected value of variable changes", () => {
it('should trigger callback when selected value of variable changes', () => {
const newValue = 100;
variable.selectedValue = newValue;

Expand All @@ -77,7 +77,7 @@ describe("NumberVariable", () => {
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
it('should clone properly', () => {
const clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
Expand Down
Loading

0 comments on commit 265852a

Please sign in to comment.