type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
() => {
if (this.props.productInfo !== undefined && this.props.productInfo.trim().length > 0) {
this.setState({ showMetadataAlertIcon: false })
}
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
(variantUuid) => {
if (variantUuid) {
fetch('/pantheon/internal/assembly/includes.json/' + variantUuid)
.then(response => response.json())
.then(responseJSON => {
if (responseJSON.includes.documents !== undefined) {
this.setState({ documentsIncluded: responseJSON.includes.documents })
}
})
}
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
responseJSON => {
if (responseJSON.includes.documents !== undefined) {
this.setState({ documentsIncluded: responseJSON.includes.documents })
}
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
(str) => {
if (str === undefined || str.trim().length === 0) {
return
}
return str.charAt(0).toUpperCase() + str.slice(1)
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const alertTitle = "Publishing " + this.props.contentType
this.setState({ alertTitle })
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
(versionType) => {
let versionValue = ""
let validationPath = ""
if (versionType !== undefined && versionType.length > 0) {
versionValue = versionType
}
validationPath = "/content" + this.props.modulePath + "/en_US/variants/" + this.props.variant + "/" + versionValue + "/validations.harray.2.json"
fetch(validationPath)
.then(response => response.json())
.then(json => {
const xrefValidation = this.getHarrayChildNamed(json, "xref")
let options = new Array()
if (xrefValidation.__children__ != undefined && xrefValidation.__children__.length > 0) {
let rootChildren = new Array()
for (const childNode of xrefValidation.__children__) {
const children = {
"name": childNode["pant:xrefTarget"], "id": childNode["pant:xrefTarget"].split(" ").join(""),
"children": [{ name: childNode["pant:message"], id: childNode["pant:message"].split(" ").join("") }]
}
rootChildren.push(children)
}
const root = { name: "xref Targets", id: "xrefs", children: rootChildren, defaultExpanded: true }
options.push(root)
}
if (versionValue === "draft") {
this.setState({ draftValidations: options })
} else {
this.setState({ releasedValidations: options })
}
})
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
json => {
const xrefValidation = this.getHarrayChildNamed(json, "xref")
let options = new Array()
if (xrefValidation.__children__ != undefined && xrefValidation.__children__.length > 0) {
let rootChildren = new Array()
for (const childNode of xrefValidation.__children__) {
const children = {
"name": childNode["pant:xrefTarget"], "id": childNode["pant:xrefTarget"].split(" ").join(""),
"children": [{ name: childNode["pant:message"], id: childNode["pant:message"].split(" ").join("") }]
}
rootChildren.push(children)
}
const root = { name: "xref Targets", id: "xrefs", children: rootChildren, defaultExpanded: true }
options.push(root)
}
if (versionValue === "draft") {
this.setState({ draftValidations: options })
} else {
this.setState({ releasedValidations: options })
}
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
(evt, treeViewItem, parentItem) => {
this.setState({
activeItems: [treeViewItem, parentItem]
});
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ClassDeclaration
|
class Versions extends Component<IProps, IState> {
public draft = [{ type: "draft", icon: BlankImage, path: "", version: "", publishedState: "Not published", updatedDate: "", firstButtonType: "primary", secondButtonType: "secondary", firstButtonText: "Publish", secondButtonText: "Preview", isDropdownOpen: false, isArchiveDropDownOpen: false, metadata: { productVersion: {} }, validations: [] }]
public release = [{ type: "release", icon: CheckImage, "path": "", version: "", publishedState: "Released", updatedDate: "", firstButtonType: "secondary", secondButtonType: "primary", firstButtonText: "Unpublish", secondButtonText: "View", isDropdownOpen: false, isArchiveDropDownOpen: false, metadata: { productVersion: {} }, validations: [], draftUploadDate: "" }]
constructor(props) {
super(props)
this.state = {
activeItems: {},
alertTitle: "",
allProducts: [],
// tslint:disable-next-line: object-literal-sort-keys
allProductVersions: [],
canChangePublishState: true,
documentsIncluded: [],
isArchiveDropDownOpen: false,
isDropDownOpen: false,
isHeadingToggle: true,
isMissingFields: false,
isModalOpen: false,
keywords: "",
login: false,
metadataPath: "",
variantPath: "",
urlFragment: "",
product: { label: "", value: "" },
productVersion: { label: "", uuid: "" },
publishAlertVisible: false,
unpublishAlertForModuleVisible: false,
results: [this.draft, this.release],
showMetadataAlertIcon: true,
successAlertVisible: false,
usecaseOptions: [
{ value: "", label: "Select Use Case", disabled: false }
],
usecaseValue: "",
assemblyData: [],
draftValidations: [],
releasedValidations: []
}
}
public componentDidMount() {
this.fetchProducts()
this.fetchVersions()
}
public componentDidUpdate(prevProps) {
if (this.props.modulePath !== prevProps.modulePath) {
this.fetchVersions()
}
}
public render() {
const header = (
<React.Fragment>
<Title headingLevel="h1" size={BaseSizes["2xl"]}>
Edit Metadata
</Title>
</React.Fragment>
)
return (
<React.Fragment>
{this.state.successAlertVisible && <div className="notification-container pant-notification-container-md">
<Alert
variant="success"
title="Edit Metadata"
actionClose={<AlertActionCloseButton onClose={this.hideSuccessAlert} />}
>
Update Successful!
</Alert>
</div>
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
InterfaceDeclaration
|
export interface IProps {
contentType: string
modulePath: string
productInfo: string
versionModulePath: string
variant: string
variantUUID: string
attributesFilePath: string
assemblies?: any
onGetUrl: (url) => any
updateDate: (releaseVersion, variantUUID) => any
onGetProduct: (productValue) => any
onGetVersion: (versionValue) => any
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
InterfaceDeclaration
|
// Define properties in Metadata
export interface IMetadata {
documentUsercase?: string
productVersion?: string
searchKeywords?: string
urlFragment?: string
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface IState {
activeItems: any
alertTitle: string
allProducts: any
allProductVersions: any
canChangePublishState: boolean
documentsIncluded: Array<{ canonical_uuid: string, path: string, title: string }>
isArchiveDropDownOpen: boolean
isDropDownOpen: boolean
isHeadingToggle: boolean
isMissingFields: boolean
isModalOpen: boolean
keywords: string
login: boolean
metadataPath: string
variantPath: string
urlFragment: string
product: { label: string, value: string }
productVersion: { label: string, uuid: string }
publishAlertVisible: boolean
unpublishAlertForModuleVisible: boolean
results: any
showMetadataAlertIcon: boolean
successAlertVisible: boolean
usecaseOptions: any
usecaseValue: string
assemblyData: []
draftValidations: any
releasedValidations: any
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
MethodDeclaration
|
public componentDidMount() {
this.fetchProducts()
this.fetchVersions()
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
MethodDeclaration
|
public componentDidUpdate(prevProps) {
if (this.props.modulePath !== prevProps.modulePath) {
this.fetchVersions()
}
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
MethodDeclaration
|
public render() {
const header = (
<React.Fragment>
<Title headingLevel="h1" size={BaseSizes["2xl"]}>
Edit Metadata
</Title>
</React.Fragment>
)
return (
<React.Fragment>
{this.state.successAlertVisible && <div className="notification-container pant-notification-container-md">
<Alert
variant="success"
title="Edit Metadata"
actionClose={<AlertActionCloseButton onClose={this.hideSuccessAlert} />}
>
Update Successful!
</Alert>
</div>
}
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
MethodDeclaration
|
metadata<
|
laubai/pantheon
|
pantheon-bundle/frontend/src/app/versions.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const presenceData: PresenceData = {
largeImageKey: "lg-gb",
},
urlParams = new URLSearchParams(window.location.search);
if (document.location.pathname === "/")
presenceData.details = "Viewing the homepage...";
else if (
urlParams.get("page") &&
urlParams.get("s") &&
urlParams.get("page") === "post"
) {
if (urlParams.get("s") === "list") {
if (urlParams.get("tags")) {
presenceData.details = "Searching...";
presenceData.state = urlParams.get("tags").replace(" ", ", ");
} else presenceData.details = "Viewing Posts List...";
} else if (urlParams.get("s") === "view" && urlParams.get("id")) {
presenceData.details = "Viewing a Post...";
presenceData.state = `Post ${urlParams.get("id")}`;
} else presenceData.details = "Viewing the homepage...";
} else presenceData.details = "Viewing the homepage...";
presence.setActivity(presenceData);
}
|
InvalidLenni/Presences
|
websites/G/Gelbooru/presence.ts
|
TypeScript
|
ArrowFunction
|
value => {
return {
allow_remixing: true,
attributions: {
content: [{ author: "", name: value.name }],
creator: "xr3ngine"
},
description: null,
id: value.id,
images: { preview: { url: value.image } },
name: value.name,
project_id: null,
type: "scene_listing"
};
}
|
Dreitser/xr3ngine
|
packages/server/src/scenes-templates/index.ts
|
TypeScript
|
ArrowFunction
|
() => ({
Component: Link,
})
|
Studiobear/designspek
|
libs/components/src/components/stories/link.stories.ts
|
TypeScript
|
ArrowFunction
|
() => ({
Component: LinkView,
props: {
linkText: 'Hi!!!',
theme: theme,
},
})
|
Studiobear/designspek
|
libs/components/src/components/stories/link.stories.ts
|
TypeScript
|
ArrowFunction
|
() => ({
Component: LinkView,
props: {
style: {
color: 'primary',
},
theme: theme,
linkText: 'I link somewhere',
href: 'https://designspek.studiobear.co',
},
})
|
Studiobear/designspek
|
libs/components/src/components/stories/link.stories.ts
|
TypeScript
|
ArrowFunction
|
() => ({
Component: LinkView,
props: {
style: {
color: 'primary',
},
theme: theme,
linkText: 'I link somewhere',
href: 'https://designspek.studiobear.co',
target: '_blank',
},
})
|
Studiobear/designspek
|
libs/components/src/components/stories/link.stories.ts
|
TypeScript
|
ArrowFunction
|
() => ({
Component: LinkView,
props: {
style: {
color: 'primary',
textDecoration: 'none',
_hover: {
color: 'secondary',
fontWeight: 'bold',
},
},
theme: theme,
linkText: 'I link somewhere',
href: 'https://designspek.studiobear.co',
target: '_blank',
},
})
|
Studiobear/designspek
|
libs/components/src/components/stories/link.stories.ts
|
TypeScript
|
ArrowFunction
|
() => ({
Component: LinkViewImage,
props: {
style: {
color: 'primary',
textDecoration: 'none',
position: 'relative',
display: 'inline-block',
w: '300px',
h: '40px',
_hover: {
color: 'secondary',
fontWeight: 'bold',
_after: {
position: 'relative',
content: '""',
width: 'calc(100% - 1em)',
height: '4px',
backgroundColor: 'rgb(255, 62, 0)',
display: 'block',
bottom: '-5px',
},
},
},
theme: theme,
linkText: '/ds-horiz.svg',
href: 'https://designspek.studiobear.co',
target: '_blank',
},
})
|
Studiobear/designspek
|
libs/components/src/components/stories/link.stories.ts
|
TypeScript
|
FunctionDeclaration
|
export function categoryReducer(state: CategoryState = initialState, action: Action): CategoryState {
if ( action.type === LOGIN_SUCCESS) {
state = initialState
}
let reducer = reducers[action.type]
if (reducer) {
return reducer(state, action)
}
return state
}
|
DiyanaDimitrova/Organize-me-UI
|
src/main/categoryMain.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface CreateCategoryRequest {
title: String
user: String
}
|
DiyanaDimitrova/Organize-me-UI
|
src/main/categoryMain.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface DeleteCategoryRequest {
id: String
user: String
}
|
DiyanaDimitrova/Organize-me-UI
|
src/main/categoryMain.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface UpdateCategoryRequest {
_id: String
title: String
user: String
}
|
DiyanaDimitrova/Organize-me-UI
|
src/main/categoryMain.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface CategoryState {
newCategoryMessage: String,
deleteCategoryMessage: String,
updateCategoryMessage: String,
categoriesListLoading: Boolean,
success: Boolean,
categoriesList: Array<any>,
currentItem: Object,
itemToBeEdited: Boolean
}
|
DiyanaDimitrova/Organize-me-UI
|
src/main/categoryMain.ts
|
TypeScript
|
ClassDeclaration
|
@NgModule({
declarations: [
AppComponent,
HeaderComponent,
FooterComponent,
HowComponent,
AboutComponent,
ProComponent,
StatsComponent,
CguComponent,
],
imports: [
CommonModule,
NgtUniversalModule,
TransferHttpCacheModule,
HttpClientModule,
HttpClientModule,
NgxEchartsModule,
NgxLoadingModule.forRoot({ primaryColour: '#003b80', secondaryColour: '#003b80', tertiaryColour: '#003b80' }),
RouterModule.forRoot([
{ path: '', component: ReportComponent },
{ path: 'stats', component: StatsComponent },
{ path: 'comment-ça-marche', component: HowComponent },
{ path: 'qui-sommes-nous', component: AboutComponent },
{ path: 'vous-êtes-un-professionnel', component: ProComponent },
{ path: 'delai-de-retractation', component: RetractationComponent },
{ path: 'conditions-generales-utilisation', component: CguComponent }
], {scrollPositionRestoration: 'top'}),
ReportModule,
BrowserModule,
BrowserAnimationsModule,
LoginModule,
SecuredModule,
BsDropdownModule.forRoot()
],
providers: [
{ provide: LOCALE_ID, useValue: 'fr' },
]
})
export class AppModule {
}
|
Gregoire-Aubert/signalement-app
|
src/app/app.module.ts
|
TypeScript
|
FunctionDeclaration
|
export default function injectHandlerDependencies(handler, context: Context) {
return (req: Request, res: Response) => {
return handler(req, res, context);
};
}
|
IoT-Stuff/device-batch-registry
|
src/util/injectHandlerDependecies.ts
|
TypeScript
|
ArrowFunction
|
(req: Request, res: Response) => {
return handler(req, res, context);
}
|
IoT-Stuff/device-batch-registry
|
src/util/injectHandlerDependecies.ts
|
TypeScript
|
ArrowFunction
|
(props: StyledButtonProps) => {
switch (props.variant) {
case "primary":
return tw`bg-primary-500 hover:bg-primary-600 focus:bg-primary-400 text-white`
case "secondary":
return tw`bg-white hover:bg-gray-100 focus:bg-white shadow text-primary-500`
default:
break;
}
}
|
Luismimultimedia/nextjs-boiler-template-ts-tailwind-styled
|
components/Button/Button.styled.ts
|
TypeScript
|
TypeAliasDeclaration
|
type StyledButtonProps = {
variant: string,
}
|
Luismimultimedia/nextjs-boiler-template-ts-tailwind-styled
|
components/Button/Button.styled.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* 多级评论
* @export
* @interface Comment
*/
export interface Comment {
/**
* 会员头像
* @type {string}
* @memberof Comment
*/
avatar?: string;
/**
* 评论内容
* @type {string}
* @memberof Comment
*/
content?: string;
/**
* 创建时间
* @type {string}
* @memberof Comment
*/
createTime?: string;
/**
* ID
* @type {string}
* @memberof Comment
*/
id?: string;
/**
* 逻辑删除 1(true)已删除, 0(false)未删除
* @type {number}
* @memberof Comment
*/
isDeleted?: number;
/**
* 会员id
* @type {string}
* @memberof Comment
*/
memberId?: string;
/**
* 更新时间
* @type {string}
* @memberof Comment
*/
modifiedTime?: string;
/**
* 会员昵称
* @type {string}
* @memberof Comment
*/
nickname?: string;
/**
* 父类id
* @type {string}
* @memberof Comment
*/
parentId?: string;
/**
* 课程id
* @type {string}
* @memberof Comment
*/
relatedId?: string;
/**
* 被回复者
* @type {string}
* @memberof Comment
*/
replyTo?: string;
/**
* 评论类型
* @type {number}
* @memberof Comment
*/
type?: number;
}
|
jzhmcoo1/code_edu_ui
|
api/schema/comment.ts
|
TypeScript
|
FunctionDeclaration
|
export default function StockList() {
let history = useHistory();
const [admin, setAdmin] = useState(false);
const [dialogOpen, setDialogOpen] = useState(false);
const [newStock, setNewStock] = useState(null);
const [dialogError, setDialogError] = useState(false);
const [imageFile, setImageFile] = useState(null);
const [tickerDesc, setTickerDesc] = useState("");
axios.defaults.withCredentials = true;
useEffect(() => {
axios.get('http://localhost:5001/currentuser').then(response => {
setAdmin(response.data.admin);
}).catch(error => {
console.log(error);
})
}, []);
const handleDialogOpen = () => {
setDialogOpen(true);
}
const handleDialogClose = () => {
setDialogOpen(false);
}
function handleNewStockChange(e: any) {
setNewStock(e.target.value);
}
const handleDescChange = (e) => {
setTickerDesc(e.target.value);
}
const handleImageChange = (e) => {
setImageFile(e.target.files[0]);
}
const handleNewStockSubmit = (e: any) => {
e.preventDefault();
let formdata = new FormData();
formdata.append('image', imageFile);
formdata.append('ticker', newStock);
formdata.append('desc', tickerDesc);
// Make request to insert watchlist
axios.defaults.withCredentials = true;
axios.post('http://localhost:5001/tickers', formdata, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(response => {
if (response.status === 200) {
history.push("/dashboard");
}
else {
setDialogError(true);
}
}).catch(error => {
console.log(error);
})
}
return (
<div>
<Navbar />
<div className={styles.container}>
<Dialog open={dialogOpen} onClose={handleDialogClose} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">New Ticker</DialogTitle>
<DialogContent>
<DialogContentText>
Enter a ticker name for a new stock to trade.
</DialogContentText>
<TextField
error={dialogError}
autoFocus
margin="dense"
id="name"
label="Ticker Name"
type="name"
fullWidth
onChange={handleNewStockChange}
/>
{dialogError ? (
<p>The ticker does not exist.</p>
) : undefined}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
FunctionDeclaration
|
function handleNewStockChange(e: any) {
setNewStock(e.target.value);
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
() => {
axios.get('http://localhost:5001/currentuser').then(response => {
setAdmin(response.data.admin);
}).catch(error => {
console.log(error);
})
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
response => {
setAdmin(response.data.admin);
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
() => {
setDialogOpen(true);
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
() => {
setDialogOpen(false);
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
(e) => {
setTickerDesc(e.target.value);
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
(e) => {
setImageFile(e.target.files[0]);
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
(e: any) => {
e.preventDefault();
let formdata = new FormData();
formdata.append('image', imageFile);
formdata.append('ticker', newStock);
formdata.append('desc', tickerDesc);
// Make request to insert watchlist
axios.defaults.withCredentials = true;
axios.post('http://localhost:5001/tickers', formdata, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(response => {
if (response.status === 200) {
history.push("/dashboard");
}
else {
setDialogError(true);
}
}).catch(error => {
console.log(error);
})
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
response => {
if (response.status === 200) {
history.push("/dashboard");
}
else {
setDialogError(true);
}
}
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
MethodDeclaration
|
dialogError ? (
<p
|
ansunsujoe/deep-trader
|
traderhub/src/components/stocklist.tsx
|
TypeScript
|
ArrowFunction
|
set => ({
tablePage: 0,
tableSize: 500,
sort: [{ id: 's', desc: true }],
filter: '',
setTablePage: newTablePage => set({ tablePage: newTablePage }),
setTableSize: newTableSize => set({ tableSize: newTableSize }),
setSort: newSort => set({ sort: newSort }),
setFilter: newFilter => set({ filter: newFilter })
})
|
AmirNaghibi/stock-analysis
|
state/tableState.ts
|
TypeScript
|
ArrowFunction
|
newTablePage => set({ tablePage: newTablePage })
|
AmirNaghibi/stock-analysis
|
state/tableState.ts
|
TypeScript
|
ArrowFunction
|
newTableSize => set({ tableSize: newTableSize })
|
AmirNaghibi/stock-analysis
|
state/tableState.ts
|
TypeScript
|
ArrowFunction
|
newSort => set({ sort: newSort })
|
AmirNaghibi/stock-analysis
|
state/tableState.ts
|
TypeScript
|
ArrowFunction
|
newFilter => set({ filter: newFilter })
|
AmirNaghibi/stock-analysis
|
state/tableState.ts
|
TypeScript
|
InterfaceDeclaration
|
interface TableState {
tablePage: number
tableSize: number
sort: SortObject[]
filter: FilterValue
setTablePage: (newTablePage: number) => void
setTableSize: (tableSize: number) => void
setSort: (sort: SortObject[]) => void
setFilter: (newFilter: FilterValue) => void
}
|
AmirNaghibi/stock-analysis
|
state/tableState.ts
|
TypeScript
|
EnumDeclaration
|
//
// SocketType.ts
//
// Created by David Rowe on 1 Sep 2021.
// Copyright 2021 Vircadia contributors.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/*@devdoc
* A {@link SocketType(1)|socket type} is the type of network {@link Socket} used for Vircadia protocol communications:
* <code>WebRTC</code>, <code>UDP</code>, or <code>Unknown</code>. Socket type values are represented as 8-bit numbers
* in the protocol packets.
* @typedef {number} SocketType
*/
const enum SocketTypeValue {
// C++ SocketType : uint8_t
Unknown = 0,
UDP = 1,
WebRTC = 2
}
|
Colorfingers/vircadia-web-sdk
|
src/domain/networking/SocketType.ts
|
TypeScript
|
MethodDeclaration
|
/*@devdoc
* Gets the name of a SocketType value, e.g., <code>"WebRTC"</code>.
* @function SocketType(1).socketTypeToString
* @param {SocketType} socketType - The socket type value.
* @returns {string} The name of the socket type value.
*/
socketTypeToString(socketType: SocketTypeValue): string {
// C++ QString socketTypeToString(SocketType socketType)
// Provided as a global function in C++ but as a method of the SocketType namespace in TypeScript.
const value = this.#_SOCKET_TYPE_STRINGS[socketType];
return value ? value : this.#_UNKNOWN;
}
|
Colorfingers/vircadia-web-sdk
|
src/domain/networking/SocketType.ts
|
TypeScript
|
ArrowFunction
|
() => {
let service: BungieService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [BungieService],
}).compile();
service = module.get<BungieService>(BungieService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
}
|
GuardianTheater/guardian-theater-monorepo
|
libs/shared-services/src/bungie/bungie.service.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [BungieService],
}).compile();
service = module.get<BungieService>(BungieService);
}
|
GuardianTheater/guardian-theater-monorepo
|
libs/shared-services/src/bungie/bungie.service.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(service).toBeDefined();
}
|
GuardianTheater/guardian-theater-monorepo
|
libs/shared-services/src/bungie/bungie.service.spec.ts
|
TypeScript
|
FunctionDeclaration
|
function removeUnsetKeys(obj: any): any {
const result = {};
for (const key of Object.keys(obj)) {
if (obj[key] !== void 0) {
result[key] = obj[key];
}
}
return result;
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function aNodeTreeDataProvider(): TreeDataProvider<{ key: string }> {
return {
getChildren: (element: { key: string }): { key: string }[] => {
return getChildren(element ? element.key : undefined).map(key => getNode(key));
},
getTreeItem: (element: { key: string }): TreeItem => {
return getTreeItem(element.key);
},
onDidChangeTreeData: onDidChangeTreeNode.event
};
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function aCompleteNodeTreeDataProvider(): TreeDataProvider<{ key: string }> {
return {
getChildren: (element: { key: string }): { key: string }[] => {
return getChildren(element ? element.key : undefined).map(key => getNode(key));
},
getTreeItem: (element: { key: string }): TreeItem => {
return getTreeItem(element.key);
},
getParent: ({ key }: { key: string }): { key: string } => {
const parentKey = key.substring(0, key.length - 1);
return parentKey ? new Key(parentKey) : void 0;
},
onDidChangeTreeData: onDidChangeTreeNode.event
};
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function aNodeWithIdTreeDataProvider(): TreeDataProvider<{ key: string }> {
return {
getChildren: (element: { key: string }): { key: string }[] => {
return getChildren(element ? element.key : undefined).map(key => getNode(key));
},
getTreeItem: (element: { key: string }): TreeItem => {
const treeItem = getTreeItem(element.key);
treeItem.id = element.key;
return treeItem;
},
onDidChangeTreeData: onDidChangeTreeNodeWithId.event
};
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function getTreeElement(element): any {
let parent = tree;
for (let i = 0; i < element.length; i++) {
parent = parent[element.substring(0, i + 1)];
if (!parent) {
return null;
}
}
return parent;
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function getChildren(key: string): string[] {
if (!key) {
return Object.keys(tree);
}
let treeElement = getTreeElement(key);
if (treeElement) {
return Object.keys(treeElement);
}
return [];
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function getTreeItem(key: string): TreeItem {
const treeElement = getTreeElement(key);
return {
label: labels[key] || key,
collapsibleState: treeElement && Object.keys(treeElement).length ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None
};
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
FunctionDeclaration
|
function getNode(key: string): { key: string } {
if (!nodes[key]) {
nodes[key] = new Key(key);
}
return nodes[key];
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
tree = {
'a': {
'aa': {},
'ab': {}
},
'b': {
'ba': {},
'bb': {}
}
};
labels = {};
nodes = {};
let rpcProtocol = new TestRPCProtocol();
// Use IInstantiationService to get typechecking when instantiating
let inst: IInstantiationService;
{
let instantiationService = new TestInstantiationService();
inst = instantiationService;
}
rpcProtocol.set(MainContext.MainThreadCommands, inst.createInstance(MainThreadCommands, rpcProtocol));
target = new RecordingShape();
testObject = new ExtHostTreeViews(target, new ExtHostCommands(rpcProtocol, new ExtHostHeapService(), new NullLogService()));
onDidChangeTreeNode = new Emitter<{ key: string }>();
onDidChangeTreeNodeWithId = new Emitter<{ key: string }>();
testObject.registerTreeDataProvider('testNodeTreeProvider', aNodeTreeDataProvider(), (fn) => fn);
testObject.registerTreeDataProvider('testNodeWithIdTreeProvider', aNodeWithIdTreeDataProvider(), (fn) => fn);
testObject.$getChildren('testNodeTreeProvider').then(elements => {
for (const element of elements) {
testObject.$getChildren('testNodeTreeProvider', element.handle);
}
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
(fn) => fn
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
for (const element of elements) {
testObject.$getChildren('testNodeTreeProvider', element.handle);
}
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
return testObject.$getChildren('testNodeTreeProvider')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a', '0/0:b']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:a')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a/0:aa', '0/0:a/0:ab']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:aa').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:ab').then(children => assert.equal(children.length, 0))
]);
}),
testObject.$getChildren('testNodeTreeProvider', '0/0:b')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:b/0:ba', '0/0:b/0:bb']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:ba').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:bb').then(children => assert.equal(children.length, 0))
]);
})
]);
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a', '0/0:b']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:a')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a/0:aa', '0/0:a/0:ab']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:aa').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:ab').then(children => assert.equal(children.length, 0))
]);
}),
testObject.$getChildren('testNodeTreeProvider', '0/0:b')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:b/0:ba', '0/0:b/0:bb']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:ba').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:bb').then(children => assert.equal(children.length, 0))
]);
})
]);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
e => e.handle
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a/0:aa', '0/0:a/0:ab']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:aa').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeTreeProvider', '0/0:a/0:ab').then(children => assert.equal(children.length, 0))
]);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
children => assert.equal(children.length, 0)
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:b/0:ba', '0/0:b/0:bb']);
return TPromise.join([
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:ba').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeTreeProvider', '0/0:b/0:bb').then(children => assert.equal(children.length, 0))
]);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
return testObject.$getChildren('testNodeWithIdTreeProvider')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['1/a', '1/b']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['1/aa', '1/ab']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/aa').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ab').then(children => assert.equal(children.length, 0))
]);
}),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/b')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['1/ba', '1/bb']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ba').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/bb').then(children => assert.equal(children.length, 0))
]);
})
]);
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['1/a', '1/b']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['1/aa', '1/ab']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/aa').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ab').then(children => assert.equal(children.length, 0))
]);
}),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/b')
.then(children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['1/ba', '1/bb']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ba').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/bb').then(children => assert.equal(children.length, 0))
]);
})
]);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['1/aa', '1/ab']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/aa').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ab').then(children => assert.equal(children.length, 0))
]);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
children => {
const actuals = children.map(e => e.handle);
assert.deepEqual(actuals, ['1/ba', '1/bb']);
return TPromise.join([
testObject.$getChildren('testNodeWithIdTreeProvider', '1/ba').then(children => assert.equal(children.length, 0)),
testObject.$getChildren('testNodeWithIdTreeProvider', '1/bb').then(children => assert.equal(children.length, 0))
]);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
tree['a'] = {
'aa': {},
};
tree['b'] = {
'aa': {},
'ba': {}
};
target.onRefresh.event(() => {
testObject.$getChildren('testNodeWithIdTreeProvider')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['1/a', '1/b']);
return testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
.then(() => testObject.$getChildren('testNodeWithIdTreeProvider', '1/b'))
.then(() => { assert.fail('Should fail with duplicate id'); done(); }, () => done());
});
});
onDidChangeTreeNode.fire();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
testObject.$getChildren('testNodeWithIdTreeProvider')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['1/a', '1/b']);
return testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
.then(() => testObject.$getChildren('testNodeWithIdTreeProvider', '1/b'))
.then(() => { assert.fail('Should fail with duplicate id'); done(); }, () => done());
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['1/a', '1/b']);
return testObject.$getChildren('testNodeWithIdTreeProvider', '1/a')
.then(() => testObject.$getChildren('testNodeWithIdTreeProvider', '1/b'))
.then(() => { assert.fail('Should fail with duplicate id'); done(); }, () => done());
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => testObject.$getChildren('testNodeWithIdTreeProvider', '1/b')
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => { assert.fail('Should fail with duplicate id'); done(); }
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.equal(undefined, actuals);
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
return new TPromise((c, e) => {
target.onRefresh.event(actuals => {
assert.deepEqual(['0/0:b'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
handle: '0/0:b',
label: 'b',
collapsibleState: TreeItemCollapsibleState.Collapsed
});
c(null);
});
onDidChangeTreeNode.fire(getNode('b'));
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
(c, e) => {
target.onRefresh.event(actuals => {
assert.deepEqual(['0/0:b'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
handle: '0/0:b',
label: 'b',
collapsibleState: TreeItemCollapsibleState.Collapsed
});
c(null);
});
onDidChangeTreeNode.fire(getNode('b'));
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.deepEqual(['0/0:b'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
handle: '0/0:b',
label: 'b',
collapsibleState: TreeItemCollapsibleState.Collapsed
});
c(null);
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.deepEqual(['0/0:b/0:bb'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:b/0:bb']), {
handle: '0/0:b/0:bb',
parentHandle: '0/0:b',
label: 'bb',
collapsibleState: TreeItemCollapsibleState.None
});
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.deepEqual(['0/0:b', '0/0:a/0:aa'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
handle: '0/0:b',
label: 'b',
collapsibleState: TreeItemCollapsibleState.Collapsed
});
assert.deepEqual(removeUnsetKeys(actuals['0/0:a/0:aa']), {
handle: '0/0:a/0:aa',
parentHandle: '0/0:a',
label: 'aa',
collapsibleState: TreeItemCollapsibleState.None
});
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.deepEqual(['0/0:a/0:aa', '0/0:b'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:b']), {
handle: '0/0:b',
label: 'b',
collapsibleState: TreeItemCollapsibleState.Collapsed
});
assert.deepEqual(removeUnsetKeys(actuals['0/0:a/0:aa']), {
handle: '0/0:a/0:aa',
parentHandle: '0/0:a',
label: 'aa',
collapsibleState: TreeItemCollapsibleState.None
});
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.deepEqual(['0/0:a'], Object.keys(actuals));
assert.deepEqual(removeUnsetKeys(actuals['0/0:a']), {
handle: '0/0:aa',
label: 'aa',
collapsibleState: TreeItemCollapsibleState.Collapsed
});
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
actuals => {
assert.deepEqual(['0/0:a', '0/0:b'], Object.keys(actuals));
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
tree = {
'a/0:b': {}
};
onDidChangeTreeNode.fire();
target.onRefresh.event(() => {
testObject.$getChildren('testNodeTreeProvider')
.then(elements => {
assert.deepEqual(elements.map(e => e.handle), ['0/0:a//0:b']);
done();
});
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
testObject.$getChildren('testNodeTreeProvider')
.then(elements => {
assert.deepEqual(elements.map(e => e.handle), ['0/0:a//0:b']);
done();
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
assert.deepEqual(elements.map(e => e.handle), ['0/0:a//0:b']);
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
const dupItems = {
'adup1': 'c',
'adup2': 'g',
'bdup1': 'e',
'hdup1': 'i',
'hdup2': 'l',
'jdup1': 'k'
};
labels['c'] = 'a';
labels['e'] = 'b';
labels['g'] = 'a';
labels['i'] = 'h';
labels['l'] = 'h';
labels['k'] = 'j';
tree[dupItems['adup1']] = {};
tree['d'] = {};
const bdup1Tree = {};
bdup1Tree['h'] = {};
bdup1Tree[dupItems['hdup1']] = {};
bdup1Tree['j'] = {};
bdup1Tree[dupItems['jdup1']] = {};
bdup1Tree[dupItems['hdup2']] = {};
tree[dupItems['bdup1']] = bdup1Tree;
tree['f'] = {};
tree[dupItems['adup2']] = {};
onDidChangeTreeNode.fire();
target.onRefresh.event(() => {
testObject.$getChildren('testNodeTreeProvider')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a', '0/0:b', '0/1:a', '0/0:d', '0/1:b', '0/0:f', '0/2:a']);
return testObject.$getChildren('testNodeTreeProvider', '0/1:b')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/1:b/0:h', '0/1:b/1:h', '0/1:b/0:j', '0/1:b/1:j', '0/1:b/2:h']);
done();
});
});
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
testObject.$getChildren('testNodeTreeProvider')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a', '0/0:b', '0/1:a', '0/0:d', '0/1:b', '0/0:f', '0/2:a']);
return testObject.$getChildren('testNodeTreeProvider', '0/1:b')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/1:b/0:h', '0/1:b/1:h', '0/1:b/0:j', '0/1:b/1:j', '0/1:b/2:h']);
done();
});
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/0:a', '0/0:b', '0/1:a', '0/0:d', '0/1:b', '0/0:f', '0/2:a']);
return testObject.$getChildren('testNodeTreeProvider', '0/1:b')
.then(elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/1:b/0:h', '0/1:b/1:h', '0/1:b/0:j', '0/1:b/1:j', '0/1:b/2:h']);
done();
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
elements => {
const actuals = elements.map(e => e.handle);
assert.deepEqual(actuals, ['0/1:b/0:h', '0/1:b/1:h', '0/1:b/0:j', '0/1:b/1:j', '0/1:b/2:h']);
done();
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
ArrowFunction
|
(done) => {
tree = {
'c': {}
};
onDidChangeTreeNode.fire();
target.onRefresh.event(() => {
testObject.$getChildren('testNodeTreeProvider')
.then(elements => {
assert.deepEqual(elements.map(e => e.handle), ['0/0:c']);
done();
});
});
}
|
CRAZYCUPCAKES40/vscode
|
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.