-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-tabs-tests.ts
40 lines (35 loc) · 1.47 KB
/
react-tabs-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as React from "react";
import * as ReactDOM from "react-dom";
import {
Tabs,
TabsProps,
TabList,
TabListProps,
Tab,
TabProps,
TabPanel,
TabPanelProps,
resetIdCounter } from "react-tabs";
resetIdCounter();
interface TestTabProps extends TabProps {}
interface TestTabListProps extends TabListProps {}
interface TestTabPanelProps extends TabPanelProps {}
interface TestTabsProps extends TabsProps {}
class TestApp extends React.Component {
onSelect = (index: number, last: number, event: Event) => {
console.log("selected tab: " + index.toString());
console.log("last tab: " + last.toString());
console.log("event: " + event.type);
}
render() {
return React.createElement(Tabs, {onSelect: this.onSelect, selectedIndex: 1},
React.createElement(TabList, {className: "test-class"},
React.createElement(Tab, {disabled: true}, "Tab1"),
React.createElement(Tab, {selectedClassName: "active"}, "Tab2"),
React.createElement(Tab, {}, "Tab3")),
React.createElement(TabPanel, {}, React.createElement("h2", {}, "Content1")),
React.createElement(TabPanel, {}, React.createElement("h2", {}, "Content2")),
React.createElement(TabPanel, {}, React.createElement("h2", {}, "Content3")));
}
}
ReactDOM.render(React.createElement(TestApp, {}), document.getElementById("test-app"));