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

Added adaptivecards-fabric #3106

Merged
merged 7 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
1,616 changes: 808 additions & 808 deletions source/nodejs/adaptivecards-controls/package-lock.json

Large diffs are not rendered by default.

1,606 changes: 803 additions & 803 deletions source/nodejs/adaptivecards-designer-app/package-lock.json

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions source/nodejs/adaptivecards-designer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { renderExtendedComponent } from "../../TestUtils";
import { InputChoiceSetFabric } from "../../../src/Components/Inputs/InputChoiceSetFabric";
import { initializeIcons } from "office-ui-fabric-react";

initializeIcons();

const inputChoiceProps = [
{
"type": "Input.ChoiceSet",
"title": "Red",
"value": "1",
},
{
"type": "Input.ChoiceSet",
"title": "Green",
"value": "2",
},
{
"type": "Input.ChoiceSet",
"title": "Blue",
"value": "3",
},
];
const inputChoiceSetComboBox = {
"type": "Input.ChoiceSet",
"isMultiSelect": false,
"style": "compact",
"value": "1",
"choices": inputChoiceProps,
};
const inputChoiceSetChoiceGroup = {
"type": "Input.ChoiceSet",
"isMultiSelect": false,
"style": "expanded",
"value": "1",
"choices": inputChoiceProps,
};
const inputChoiceSetComboBoxMultiSelect = {
"type": "Input.ChoiceSet",
"isMultiSelect": true,
"style": "compact",
"value": "1, 2",
"choices": inputChoiceProps,
};
const inputChoiceSetCheckboxMultiSelect = {
"type": "Input.ChoiceSet",
"isMultiSelect": true,
"style": "expanded",
"value": "1,3",
"choices": inputChoiceProps,
};

describe("InputChoiceSet", () => {
it("inputChoiceSetComboBox should be rendered correctly", () => {
let el = renderExtendedComponent(InputChoiceSetFabric, inputChoiceSetComboBox);
expect(el).toMatchSnapshot();
});

it("inputChoiceSetChoiceGroup should be rendered correctly", () => {
let el = renderExtendedComponent(InputChoiceSetFabric, inputChoiceSetChoiceGroup);
expect(el).toMatchSnapshot();
});

it("inputChoiceSetComboBoxMultiSelect should be rendered correctly", () => {
let el = renderExtendedComponent(InputChoiceSetFabric, inputChoiceSetComboBoxMultiSelect);
expect(el).toMatchSnapshot();
});

it("inputChoiceSetCheckboxMultiSelect should be rendered correctly", () => {
let el = renderExtendedComponent(InputChoiceSetFabric, inputChoiceSetCheckboxMultiSelect);
expect(el).toMatchSnapshot();
});

it("can get json name", () => {
expect(new InputChoiceSetFabric().getJsonTypeName()).toBe("Input.ChoiceSet");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { InputDateFabric } from "../../../src/Components/Inputs/InputDateFabric";
import { initializeIcons } from "@uifabric/icons";
import * as TestUtils from "../../TestUtils";

initializeIcons();

describe("InputDateExtended", () => {
it("should be rendered successfully", () => {
let input = new InputDateFabric();

expect(input).toBeDefined();
expect(input.render()).toBeDefined();
});

it("renders component correctly", () => {
let input = TestUtils.renderExtendedComponent(InputDateFabric, {
type: "Input.Date",
id: "date",
spacing: "none",
value: "5/14/2019",
placeholder: "Enter a date",
max: "1/1/2020",
min: "1/1/2010",
});

expect(input).toMatchSnapshot();
});

it("can get json name", () => {
expect(new InputDateFabric().getJsonTypeName()).toBe("Input.Date");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { InputTextFabric } from "../../../src/Components/Inputs/InputTextFabric";
import * as TestUtils from "../../TestUtils";
import { initializeIcons } from "office-ui-fabric-react";

initializeIcons();

describe("InputTextExtended", () => {
it("should be rendered successfully", () => {
let input = new InputTextFabric();

expect(input).toBeDefined();
expect(input.render()).toBeDefined();
});

it("renders int text multiline correctly", () => {
let input = TestUtils.renderExtendedComponent(InputTextFabric, {
"type": "Input.Text",
"id": "input3",
"placeholder": "enter comment",
"maxLength": 500,
"isMultiline": true,
"value": "This value was pre-filled",
});

expect(input).toMatchSnapshot();
});

it("renders int text single line correctly", () => {
let input = TestUtils.renderExtendedComponent(InputTextFabric, {
"type": "Input.Text",
"id": "input3",
"placeholder": "enter comment",
"maxLength": 500,
"isMultiline": false,
"value": "This value was pre-filled",
});

expect(input).toMatchSnapshot();
});

it("can set initial value", () => {
let el = TestUtils.renderExtendedComponent(InputTextFabric, {
"type": "Input.Text",
"id": "input3",
"placeholder": "enter comment",
"maxLength": 500,
"value": "This value was pre-filled",
});

expect(el).toBeDefined();
let inputElement = el.querySelector("input");
expect(inputElement).not.toBe(null);
expect(inputElement.getAttribute("value")).toBe("This value was pre-filled");
});

it("can render placeholder", () => {
let el = TestUtils.renderExtendedComponent(InputTextFabric, {
"type": "Input.Text",
"id": "blah",
"placeholder": "enter comment",
});

expect(el).toBeDefined();
let inputElement = el.querySelector("input");
expect(inputElement).not.toBe(null);
expect(inputElement.getAttribute("placeholder")).toBe("enter comment");
});

it("can get json name", () => {
expect(new InputTextFabric().getJsonTypeName()).toBe("Input.Text");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { InputTimeFabric } from "../../../src/Components/Inputs/InputTimeFabric";
import * as TestUtils from "../../TestUtils";
import { initializeIcons } from "office-ui-fabric-react";

initializeIcons();

describe("InputTimeExtended", () => {
it("should be rendered successfully", () => {
let input = new InputTimeFabric();

expect(input).toBeDefined();
expect(input.render()).toBeDefined();
});

it("should render input time correctly", () => {
let input = TestUtils.renderExtendedComponent(InputTimeFabric, {
"type": "Input.Time",
"id": "time",
"min": "09:00",
"max": "17:00",
"value": "15:30",
});

expect(input).toBeDefined();
expect(input).toMatchSnapshot();
});

it("can get json name", () => {
expect(new InputTimeFabric().getJsonTypeName()).toBe("Input.Time");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { InputToggleFabric } from "../../../src/Components/Inputs/InputToggleFabric";
import { renderExtendedComponent } from "../../TestUtils";
import { initializeIcons } from "office-ui-fabric-react";

initializeIcons();

const toggleProps = {
type: "Input.Toggle",
title: "Are you sure?",
value: "yeah",
valueOn: "yeah",
valueOff: "nope",
};

describe("InputToggleExtended", () => {
it("should be rendered correctly", () => {
let el = renderExtendedComponent(InputToggleFabric, toggleProps);

expect(el).toMatchSnapshot();
});

it("can set initial value", () => {
let el = renderExtendedComponent(InputToggleFabric, toggleProps);

expect(el.querySelector("button").getAttribute("aria-checked")).toBe("true");
});

it("can get json name", () => {
expect(new InputToggleFabric().getJsonTypeName()).toBe("Input.Toggle");
});
});
Loading