commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
fb642b6b6f218284c21a63145fed3ce02e7b1e12
desktop/src/main/local-protocol.ts
desktop/src/main/local-protocol.ts
/** * Provides secure access to local media files by rewriting `file://` * URLs to use this custom protocols which requires a HMAC * (hash-based message authentication code) for each requested path. */ import { createHmac, randomBytes } from 'crypto' import { Protocol } from 'electron' export const scheme = 'local' const secret = randomBytes(256) /** * Generate a HMAC for a path */ const generateHmac = (path: string) => createHmac('sha256', secret).update(path).digest('hex') /** * Rewrite a HTML page replacing `file://` URLs with `local://` URLs * with a HMAC appended. */ export const rewriteHtml = (html: string): string => { return html.replace( /(src=")file:\/\/(.*?)"/g, (_match, prefix: string, path: string) => `${prefix}${scheme}://${path}?${generateHmac(path)}"` ) } type RequestHandler = Parameters<Protocol['registerFileProtocol']>['1'] /** * Handle a request to this protocol by checking that the HMAC is correct * for the path and returning the path if it is and a 403 Forbidden otherwise. */ export const requestHandler: RequestHandler = (request, callback) => { const { pathname, search } = new URL(request.url) if (search.slice(1) == generateHmac(pathname)) callback({ statusCode: 200, path: pathname }) else callback({ statusCode: 403 }) }
/** * Provides secure access to local media files by rewriting `file://` * URLs to use this custom protocols which requires a HMAC * (hash-based message authentication code) for each requested path. */ import { createHmac, randomBytes } from 'crypto' import { Protocol } from 'electron' export const scheme = 'local' const secret = randomBytes(256) /** * Generate a HMAC for a path */ const generateHmac = (path: string) => createHmac('sha256', secret).update(path).digest('hex') /** * Rewrite a HTML page replacing `file://` URLs with `local://` URLs * with a HMAC appended. */ export const rewriteHtml = (html: string): string => { return html.replace( /(src=")file:\/\/(.*?)"/g, (_match, prefix: string, path: string) => { const pathname = encodeURI(path) const hmac = generateHmac(path) return `${prefix}${scheme}://${pathname}?${hmac}"` } ) } type RequestHandler = Parameters<Protocol['registerFileProtocol']>['1'] /** * Handle a request to this protocol by checking that the HMAC is correct * for the path and returning the path if it is and a 403 Forbidden otherwise. */ export const requestHandler: RequestHandler = (request, callback) => { const { pathname, search } = new URL(request.url) const path = decodeURI(pathname) const hmac = generateHmac(path) if (search.slice(1) == hmac) callback({ statusCode: 200, path }) else callback({ statusCode: 403 }) }
Handle paths with spaces and other percent encoded names
fix(Desktop): Handle paths with spaces and other percent encoded names
TypeScript
apache-2.0
stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila
--- +++ @@ -24,8 +24,11 @@ export const rewriteHtml = (html: string): string => { return html.replace( /(src=")file:\/\/(.*?)"/g, - (_match, prefix: string, path: string) => - `${prefix}${scheme}://${path}?${generateHmac(path)}"` + (_match, prefix: string, path: string) => { + const pathname = encodeURI(path) + const hmac = generateHmac(path) + return `${prefix}${scheme}://${pathname}?${hmac}"` + } ) } @@ -37,7 +40,8 @@ */ export const requestHandler: RequestHandler = (request, callback) => { const { pathname, search } = new URL(request.url) - if (search.slice(1) == generateHmac(pathname)) - callback({ statusCode: 200, path: pathname }) + const path = decodeURI(pathname) + const hmac = generateHmac(path) + if (search.slice(1) == hmac) callback({ statusCode: 200, path }) else callback({ statusCode: 403 }) }
7d363469ab12ec68ab7e9b59a2d2de50a0d36a08
applications/mail/src/app/components/list/ListSettings.tsx
applications/mail/src/app/components/list/ListSettings.tsx
import { memo } from 'react'; import { MailSettings } from '@proton/shared/lib/interfaces'; import { Filter, Sort } from '../../models/tools'; import FilterActions from '../toolbar/FilterActions'; import SortDropdown from '../toolbar/SortDropdown'; interface Props { sort: Sort; onSort: (sort: Sort) => void; filter: Filter; onFilter: (filter: Filter) => void; conversationMode: boolean; mailSettings: MailSettings; isSearch: boolean; labelID?: string; } const ListSettings = ({ sort, onSort, onFilter, filter, conversationMode, mailSettings, isSearch, labelID }: Props) => { return ( <div className="sticky-top upper-layer bg-norm border-bottom border-weak pl0-5 pr0-5 pt0-25 pb0-25 flex flex-wrap flex-justify-space-between"> <FilterActions filter={filter} onFilter={onFilter} mailSettings={mailSettings} /> <SortDropdown conversationMode={conversationMode} sort={sort} onSort={onSort} hasCaret={false} isSearch={isSearch} labelID={labelID} /> </div> ); }; export default memo(ListSettings);
import { memo } from 'react'; import { MailSettings } from '@proton/shared/lib/interfaces'; import { Filter, Sort } from '../../models/tools'; import FilterActions from '../toolbar/FilterActions'; import SortDropdown from '../toolbar/SortDropdown'; interface Props { sort: Sort; onSort: (sort: Sort) => void; filter: Filter; onFilter: (filter: Filter) => void; conversationMode: boolean; mailSettings: MailSettings; isSearch: boolean; labelID?: string; } const ListSettings = ({ sort, onSort, onFilter, filter, conversationMode, mailSettings, isSearch, labelID }: Props) => { return ( <div className="sticky-top upper-layer bg-norm border-bottom border-weak px0-5 py0-25 flex flex-wrap flex-justify-space-between"> <FilterActions filter={filter} onFilter={onFilter} mailSettings={mailSettings} /> <SortDropdown conversationMode={conversationMode} sort={sort} onSort={onSort} hasCaret={false} isSearch={isSearch} labelID={labelID} /> </div> ); }; export default memo(ListSettings);
Apply 1 suggestion(s) to 1 file(s)
Apply 1 suggestion(s) to 1 file(s)
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -19,7 +19,7 @@ const ListSettings = ({ sort, onSort, onFilter, filter, conversationMode, mailSettings, isSearch, labelID }: Props) => { return ( - <div className="sticky-top upper-layer bg-norm border-bottom border-weak pl0-5 pr0-5 pt0-25 pb0-25 flex flex-wrap flex-justify-space-between"> + <div className="sticky-top upper-layer bg-norm border-bottom border-weak px0-5 py0-25 flex flex-wrap flex-justify-space-between"> <FilterActions filter={filter} onFilter={onFilter} mailSettings={mailSettings} /> <SortDropdown conversationMode={conversationMode}
0a7159390f26e7febe1469efcf004eb3272c621d
packages/editor/src/mode/ipython.ts
packages/editor/src/mode/ipython.ts
// https://github.com/nteract/nteract/issues/389 import CodeMirror from "codemirror"; import "codemirror/mode/meta"; import "codemirror/mode/python/python"; CodeMirror.defineMode( "text/x-ipython", ( conf: CodeMirror.EditorConfiguration, parserConf: any ): CodeMirror.Mode<any> => { const ipythonConf = Object.assign({}, parserConf, { name: "python", singleOperators: new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]"), identifiers: new RegExp( "^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*" ) // Technically Python3 }); return CodeMirror.getMode(conf, ipythonConf); }, "python" ); CodeMirror.defineMIME("text/x-ipython", "ipython");
// https://github.com/nteract/nteract/issues/389 import CodeMirror from "codemirror"; import "codemirror/mode/meta"; import "codemirror/mode/python/python"; CodeMirror.defineMode( "ipython", ( conf: CodeMirror.EditorConfiguration, parserConf: any ): CodeMirror.Mode<any> => { const ipythonConf = Object.assign({}, parserConf, { name: "python", singleOperators: new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]"), identifiers: new RegExp( "^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*" ) // Technically Python3 }); return CodeMirror.getMode(conf, ipythonConf); }, "python" ); CodeMirror.defineMIME("text/x-ipython", "ipython");
Fix syntax highlighting for Python
Fix syntax highlighting for Python
TypeScript
bsd-3-clause
rgbkrk/nteract,rgbkrk/nteract,nteract/nteract,nteract/composition,rgbkrk/nteract,rgbkrk/nteract,nteract/nteract,rgbkrk/nteract,nteract/composition,nteract/nteract,nteract/nteract,nteract/nteract,nteract/composition
--- +++ @@ -5,7 +5,7 @@ import "codemirror/mode/python/python"; CodeMirror.defineMode( - "text/x-ipython", + "ipython", ( conf: CodeMirror.EditorConfiguration, parserConf: any
0511efcfd58894c9dc0608ec8329046b45fd62ab
source/parser/parser.ts
source/parser/parser.ts
export abstract class Parser { static workerBase = ""; public getBase(): string { return Parser.workerBase; } abstract parse(file: File, options: any): Promise<any>; }
export abstract class Parser { static codeBase = ""; public getWorkersBase(): string { return Parser.codeBase + "/workers/"; } abstract parse(file: File, options: any): Promise<any>; }
Change the way web workers are notified of code base
Change the way web workers are notified of code base
TypeScript
apache-2.0
Tomella/explorer-3d,Tomella/explorer-3d,Tomella/explorer-3d
--- +++ @@ -1,8 +1,8 @@ export abstract class Parser { - static workerBase = ""; + static codeBase = ""; - public getBase(): string { - return Parser.workerBase; + public getWorkersBase(): string { + return Parser.codeBase + "/workers/"; } abstract parse(file: File, options: any): Promise<any>;
ceb17f09017b2c3712f056fe7e2463b722e1cd02
app/src/app/pages/locale/locale-page.component.ts
app/src/app/pages/locale/locale-page.component.ts
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'locale-page', templateUrl: 'locale-page.component.html' }) export class LocalePage implements OnInit { ngOnInit() { } }
import { Component, OnInit } from '@angular/core'; import { LocalesService } from './../../locales/services/locales.service'; @Component({ providers: [LocalesService], selector: 'locale-page', templateUrl: 'locale-page.component.html' }) export class LocalePage implements OnInit { ngOnInit() { } }
Set page level locales service
Set page level locales service
TypeScript
mit
todes1/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot,anthonynsimon/parrot,anthonynsimon/parrot,todes1/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot,anthonynsimon/parrot,anthonynsimon/parrot
--- +++ @@ -1,6 +1,9 @@ import { Component, OnInit } from '@angular/core'; +import { LocalesService } from './../../locales/services/locales.service'; + @Component({ + providers: [LocalesService], selector: 'locale-page', templateUrl: 'locale-page.component.html' })
4fc2303010afafcace0c5688b3de9b8ec7a47c31
web/vtadmin/src/components/pips/BackupStatusPip.tsx
web/vtadmin/src/components/pips/BackupStatusPip.tsx
/** * Copyright 2021 The Vitess Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Pip, PipState } from './Pip'; import { mysqlctl } from '../../proto/vtadmin'; interface Props { status: mysqlctl.BackupInfo.Status | null | undefined; } const STATUS_STATES: { [s in mysqlctl.BackupInfo.Status]: PipState } = { [mysqlctl.BackupInfo.Status.UNKNOWN]: 'danger', [mysqlctl.BackupInfo.Status.INCOMPLETE]: 'danger', [mysqlctl.BackupInfo.Status.COMPLETE]: 'danger', [mysqlctl.BackupInfo.Status.INVALID]: 'danger', [mysqlctl.BackupInfo.Status.VALID]: 'danger', }; export const BackupStatusPip = ({ status }: Props) => { const state = status ? STATUS_STATES[status] : null; return <Pip state={state} />; };
/** * Copyright 2021 The Vitess Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Pip, PipState } from './Pip'; import { mysqlctl } from '../../proto/vtadmin'; interface Props { status: mysqlctl.BackupInfo.Status | null | undefined; } const STATUS_STATES: { [s in mysqlctl.BackupInfo.Status]: PipState } = { [mysqlctl.BackupInfo.Status.UNKNOWN]: null, [mysqlctl.BackupInfo.Status.INCOMPLETE]: 'warning', [mysqlctl.BackupInfo.Status.COMPLETE]: 'primary', [mysqlctl.BackupInfo.Status.INVALID]: 'danger', [mysqlctl.BackupInfo.Status.VALID]: 'success', }; export const BackupStatusPip = ({ status }: Props) => { const state = status ? STATUS_STATES[status] : null; return <Pip state={state} />; };
Set Backup status indicators to the correct colours :|
[vtadmin-web] Set Backup status indicators to the correct colours :| Signed-off-by: Sara Bee <135b746314d6d3856a946b02fc025a1e267629b2@users.noreply.github.com>
TypeScript
apache-2.0
mahak/vitess,vitessio/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,vitessio/vitess,mahak/vitess,vitessio/vitess,mahak/vitess,mahak/vitess,vitessio/vitess,vitessio/vitess,mahak/vitess,vitessio/vitess,mahak/vitess,mahak/vitess
--- +++ @@ -22,11 +22,11 @@ } const STATUS_STATES: { [s in mysqlctl.BackupInfo.Status]: PipState } = { - [mysqlctl.BackupInfo.Status.UNKNOWN]: 'danger', - [mysqlctl.BackupInfo.Status.INCOMPLETE]: 'danger', - [mysqlctl.BackupInfo.Status.COMPLETE]: 'danger', + [mysqlctl.BackupInfo.Status.UNKNOWN]: null, + [mysqlctl.BackupInfo.Status.INCOMPLETE]: 'warning', + [mysqlctl.BackupInfo.Status.COMPLETE]: 'primary', [mysqlctl.BackupInfo.Status.INVALID]: 'danger', - [mysqlctl.BackupInfo.Status.VALID]: 'danger', + [mysqlctl.BackupInfo.Status.VALID]: 'success', }; export const BackupStatusPip = ({ status }: Props) => {
747e8c76aa794c2f80dc5b56808714e450771336
addon/models/product.ts
addon/models/product.ts
import DS from "ember-data"; import { computed, get } from "@ember/object"; import Brand from "./brand"; import Sku from "./sku"; import ProductField from "./product-field"; import ProductImage from "./product-image"; import ProductCategory from "./product-category"; import FieldSchema from "./field-schema"; import ShopProductPaymentMethod from "./shop-product-payment-method"; export default class Product extends DS.Model { @DS.attr("string") name!: string; @DS.attr("string") summary!: string; @DS.attr("string") description!: string; @DS.attr("string") slug!: string; @DS.belongsTo("brand") brand!: Brand; @DS.hasMany("sku") skus!: Sku[]; @DS.hasMany("product-field") productFields!: ProductField[]; @DS.hasMany("product-image") productImages!: ProductImage[]; @DS.hasMany("product-category") productCategories!: ProductCategory[]; @DS.hasMany("shop-product-payment-method") shopProductPaymentMethods!: ShopProductPaymentMethod[]; @DS.hasMany("field-schema") schema!: FieldSchema[]; @DS.hasMany("field-schema") skuSchema!: FieldSchema[]; @computed("productFields.[]") get attributes(): any { return this.productFields.reduce((hash: any, attribute: any) => { hash[get(attribute, "slug")] = get(attribute, "values"); return hash; }, {}); } } declare module "ember-data/types/registries/model" { export default interface ModelRegistry { product: Product; } }
import DS from "ember-data"; import Brand from "./brand"; import Sku from "./sku"; import ProductCategory from "./product-category"; import ShopProductPaymentMethod from "./shop-product-payment-method"; export default class Product extends DS.Model { @DS.attr("string") declare name: string; @DS.attr("string") declare summary: string; @DS.attr("string") declare description: string; @DS.attr("string") declare slug: string; @DS.attr("string") declare skuName: string; @DS.belongsTo("brand") declare brand: Brand; @DS.hasMany("sku") declare skus: Sku[]; @DS.hasMany("product-category") declare productCategories: ProductCategory[]; @DS.hasMany("shop-product-payment-method") declare shopProductPaymentMethods: ShopProductPaymentMethod[]; @DS.attr() declare attrs: any; @DS.attr() declare schema: any; @DS.attr() declare skuSchema: any; } declare module "ember-data/types/registries/model" { export default interface ModelRegistry { product: Product; } }
Remove computed attributes from Product model
Remove computed attributes from Product model
TypeScript
mit
goods/ember-goods,goods/ember-goods,goods/ember-goods
--- +++ @@ -1,35 +1,23 @@ import DS from "ember-data"; -import { computed, get } from "@ember/object"; import Brand from "./brand"; import Sku from "./sku"; -import ProductField from "./product-field"; -import ProductImage from "./product-image"; import ProductCategory from "./product-category"; -import FieldSchema from "./field-schema"; import ShopProductPaymentMethod from "./shop-product-payment-method"; export default class Product extends DS.Model { - @DS.attr("string") name!: string; - @DS.attr("string") summary!: string; - @DS.attr("string") description!: string; - @DS.attr("string") slug!: string; - @DS.belongsTo("brand") brand!: Brand; - @DS.hasMany("sku") skus!: Sku[]; - @DS.hasMany("product-field") productFields!: ProductField[]; - @DS.hasMany("product-image") productImages!: ProductImage[]; - @DS.hasMany("product-category") productCategories!: ProductCategory[]; + @DS.attr("string") declare name: string; + @DS.attr("string") declare summary: string; + @DS.attr("string") declare description: string; + @DS.attr("string") declare slug: string; + @DS.attr("string") declare skuName: string; + @DS.belongsTo("brand") declare brand: Brand; + @DS.hasMany("sku") declare skus: Sku[]; + @DS.hasMany("product-category") declare productCategories: ProductCategory[]; @DS.hasMany("shop-product-payment-method") - shopProductPaymentMethods!: ShopProductPaymentMethod[]; - @DS.hasMany("field-schema") schema!: FieldSchema[]; - @DS.hasMany("field-schema") skuSchema!: FieldSchema[]; - - @computed("productFields.[]") - get attributes(): any { - return this.productFields.reduce((hash: any, attribute: any) => { - hash[get(attribute, "slug")] = get(attribute, "values"); - return hash; - }, {}); - } + declare shopProductPaymentMethods: ShopProductPaymentMethod[]; + @DS.attr() declare attrs: any; + @DS.attr() declare schema: any; + @DS.attr() declare skuSchema: any; } declare module "ember-data/types/registries/model" {
9d25920671877a86d2202e51dc4767ae776ef71f
src/client/app/utils/csvUploadDefaults.ts
src/client/app/utils/csvUploadDefaults.ts
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { ReadingsCSVUploadPreferencesItem, MetersCSVUploadPreferencesItem, TimeSortTypes } from '../types/csvUploadForm'; // This file contains the default parameters for uploading readings and meters CSV files. These defaults should be consistent with the defaults // specified in /src/server/services/csvPipeline/validateCsvUploadParams and with /src/server/sql/create_meters_table.sql. export const ReadingsCSVUploadDefaults: ReadingsCSVUploadPreferencesItem = { createMeter: false, cumulative: false, cumulativeReset: false, cumulativeResetStart: '00:00:00', cumulativeResetEnd: '23:59:59.999999', duplications: '1', gzip: false, headerRow: false, length: '', lengthVariation: '', meterName: '', refreshReadings: false, timeSort: TimeSortTypes.increasing, update: false } export const MetersCSVUploadDefaults: MetersCSVUploadPreferencesItem = { gzip: false, headerRow: false, update: false }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { ReadingsCSVUploadPreferencesItem, MetersCSVUploadPreferencesItem, TimeSortTypes } from '../types/csvUploadForm'; // This file contains the default parameters for uploading readings and meters CSV files. These defaults should be consistent with the defaults // specified in /src/server/services/csvPipeline/validateCsvUploadParams and with /src/server/sql/create_meters_table.sql. export const ReadingsCSVUploadDefaults: ReadingsCSVUploadPreferencesItem = { createMeter: false, cumulative: false, cumulativeReset: false, cumulativeResetStart: '', cumulativeResetEnd: '', duplications: '1', gzip: false, headerRow: false, length: '', lengthVariation: '', meterName: '', refreshReadings: false, timeSort: TimeSortTypes.increasing, update: false } export const MetersCSVUploadDefaults: MetersCSVUploadPreferencesItem = { gzip: false, headerRow: false, update: false }
Remove form default for cum reset start and end values
Remove form default for cum reset start and end values
TypeScript
mpl-2.0
OpenEnergyDashboard/OED,OpenEnergyDashboard/OED,OpenEnergyDashboard/OED,OpenEnergyDashboard/OED
--- +++ @@ -11,8 +11,8 @@ createMeter: false, cumulative: false, cumulativeReset: false, - cumulativeResetStart: '00:00:00', - cumulativeResetEnd: '23:59:59.999999', + cumulativeResetStart: '', + cumulativeResetEnd: '', duplications: '1', gzip: false, headerRow: false,
e255d5e2ae5a1f434b5b38678243e57bb1d8b796
src/Apps/Order/OrderApp.tsx
src/Apps/Order/OrderApp.tsx
import React, { SFC } from "react" export interface OrderAppProps { orderID: string me: { name: string } } // @ts-ignore export const OrderApp: SFC<OrderAppProps> = ({ orderID, me }) => ( <div> {me.name} {orderID} </div> )
import React, { SFC } from "react" export interface OrderAppProps { me: { name: string } } // @ts-ignore export const OrderApp: SFC<OrderAppProps> = ({ me }) => <div>{me.name}</div>
Remove order ID references temporarily
Remove order ID references temporarily
TypeScript
mit
xtina-starr/reaction,artsy/reaction-force,xtina-starr/reaction,artsy/reaction,xtina-starr/reaction,artsy/reaction,xtina-starr/reaction,artsy/reaction-force,artsy/reaction
--- +++ @@ -1,16 +1,10 @@ import React, { SFC } from "react" export interface OrderAppProps { - orderID: string me: { name: string } } // @ts-ignore -export const OrderApp: SFC<OrderAppProps> = ({ orderID, me }) => ( - <div> - {me.name} - {orderID} - </div> -) +export const OrderApp: SFC<OrderAppProps> = ({ me }) => <div>{me.name}</div>
61aaa1f968c88862e5b8a89eca2b23e0a0d315b0
client/imports/song/songs.component.ts
client/imports/song/songs.component.ts
import { Component, OnInit } from '@angular/core'; import { Songs } from '../../../imports/collections'; import template from "./songs.html"; @Component({ selector: 'songs', template }) export class SongsComponent implements OnInit { songs; ngOnInit(): void { this.songs = Songs.find({}); } }
import { Component, OnInit } from '@angular/core'; import { Songs } from '../../../imports/collections'; import template from "./songs.html"; @Component({ selector: 'songs', template }) export class SongsComponent implements OnInit { songs; ngOnInit(): void { this.songs = Songs.find({}, { sort: { createdAt: -1 } }); } }
Sort songs in reverse creation order
Sort songs in reverse creation order
TypeScript
agpl-3.0
singularities/song-pot,singularities/song-pot,singularities/songs-pot,singularities/songs-pot,singularities/song-pot,singularities/songs-pot
--- +++ @@ -13,6 +13,10 @@ songs; ngOnInit(): void { - this.songs = Songs.find({}); + this.songs = Songs.find({}, { + sort: { + createdAt: -1 + } + }); } }
ab2132d8527f1049d0ced4ae7ba44cc6db3a4af7
main.ts
main.ts
import bodyParser = require('body-parser'); import express = require('express'); import plugin = require('./core/plugin'); let app = express(); (() => { plugin.initialize(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); app.get('/', function (req, res) { res.send('Hello World!'); }); function handlePlugin(req: express.Request, res: express.Response) { plugin.get(req.params.name).handle(req, res); } app.get('/plugin/:name/:action(*)', handlePlugin); app.post('/plugin/:name/:action(*)', handlePlugin); let server = app.listen(9000, function () { let host = server.address().address; let port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); }); })();
import bodyParser = require('body-parser'); import express = require('express'); import db = require('./core/db'); import plugin = require('./core/plugin'); let appConfig = require('./config/app'); let app = express(); plugin.initialize(); db.initialize(appConfig.mongodb.url) .onSuccess(() => { let exitHandler = () => { console.log('Closing db connection.'); db.close(true); }; let signalExit = (sig: string) => { return () => { console.log('Process terminated by ' + sig); process.exit(0); }; }; process.on('SIGINT', signalExit('SIGINT')); process.on('SIGTERM', signalExit('SIGTERM')); process.on('exit', exitHandler); process.on('uncaughtException', (ex: Error) => { console.error('Uncaught exception %j', ex); exitHandler(); }); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); app.get('/', function (req, res) { res.send('Hello World!'); }); function handlePlugin(req: express.Request, res: express.Response) { plugin.get(req.params.name).handle(req, res); } app.get('/plugin/:name/:action(*)', handlePlugin); app.post('/plugin/:name/:action(*)', handlePlugin); let server = app.listen(9000, function () { let host = server.address().address; let port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); }); });
Initialize db on start and close at exit.
Initialize db on start and close at exit.
TypeScript
apache-2.0
sgkim126/beyond.ts,sgkim126/beyond.ts,noraesae/beyond.ts,murmur76/beyond.ts,SollmoStudio/beyond.ts,SollmoStudio/beyond.ts,murmur76/beyond.ts,noraesae/beyond.ts
--- +++ @@ -1,11 +1,32 @@ import bodyParser = require('body-parser'); import express = require('express'); +import db = require('./core/db'); import plugin = require('./core/plugin'); + +let appConfig = require('./config/app'); let app = express(); -(() => { - plugin.initialize(); +plugin.initialize(); +db.initialize(appConfig.mongodb.url) +.onSuccess(() => { + let exitHandler = () => { + console.log('Closing db connection.'); + db.close(true); + }; + let signalExit = (sig: string) => { + return () => { + console.log('Process terminated by ' + sig); + process.exit(0); + }; + }; + process.on('SIGINT', signalExit('SIGINT')); + process.on('SIGTERM', signalExit('SIGTERM')); + process.on('exit', exitHandler); + process.on('uncaughtException', (ex: Error) => { + console.error('Uncaught exception %j', ex); + exitHandler(); + }); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); @@ -26,4 +47,4 @@ console.log('Example app listening at http://%s:%s', host, port); }); -})(); +});
4e6af5c7941ce7778efb0d26ef6355d089b7fa88
src/components/card/card.component.ts
src/components/card/card.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { humanizeMeasureName } from '../../utils/formatters'; import { Meta } from '../../datasets/metas/types'; import { TabbedChartsMeta } from '../../datasets/metas/tabbed-charts.meta'; @Component({ selector: 'app-card', templateUrl: './card.component.html', styleUrls: ['./card.component.scss'], }) export class CardComponent<T extends Meta> implements OnInit { @Input() meta: T; humanizeMeasureName = humanizeMeasureName; currentTabTitle: string; get titles() { if (this.isTabbed()) { return this.meta.metas.map(c => c.title); } else { return [this.meta.title]; } } get currentChart(): Meta { if (this.isTabbed()) { const { metas } = this.meta; return metas.find(c => c.title === this.currentTabTitle) ?? metas[0]; } else { return this.meta; } } ngOnInit() { if (this.isTabbed()) { this.setCurrentTabTitle(this.meta.metas[0].title); } else { this.setCurrentTabTitle(''); } } setCurrentTabTitle(title) { this.currentTabTitle = title; } isTabbed(): this is CardComponent<TabbedChartsMeta> { return this.meta.type === 'tabbed'; } }
import { Component, Input, OnInit } from '@angular/core'; import { humanizeMeasureName } from '../../utils/formatters'; import { Meta } from '../../datasets/metas/types'; import { TabbedChartsMeta } from '../../datasets/metas/tabbed-charts.meta'; @Component({ selector: 'app-card', templateUrl: './card.component.html', styleUrls: ['./card.component.scss'], }) export class CardComponent<T extends Meta> implements OnInit { @Input() meta: T; humanizeMeasureName = humanizeMeasureName; currentTabTitle: string; get titles(): string[] { if (this.isTabbed()) { return this.meta.metas.map(c => c.title); } else { return [this.meta.title]; } } get currentChart(): Meta { if (this.isTabbed()) { const { metas } = this.meta; return metas.find(c => c.title === this.currentTabTitle) ?? metas[0]; } else { return this.meta; } } ngOnInit() { if (this.isTabbed()) { this.setCurrentTabTitle(this.meta.metas[0].title); } else { this.setCurrentTabTitle(''); } } setCurrentTabTitle(title) { this.currentTabTitle = title; } isTabbed(): this is CardComponent<TabbedChartsMeta> { return this.meta.type === 'tabbed'; } }
Add type to getter in CardComponent
Add type to getter in CardComponent
TypeScript
apache-2.0
googleinterns/guide-doge,googleinterns/guide-doge,googleinterns/guide-doge
--- +++ @@ -13,7 +13,7 @@ humanizeMeasureName = humanizeMeasureName; currentTabTitle: string; - get titles() { + get titles(): string[] { if (this.isTabbed()) { return this.meta.metas.map(c => c.title); } else {
de4aa20a66c991429ec7bb416d899e5747744bad
src/app/hero-service.stub.ts
src/app/hero-service.stub.ts
import createSpy = jasmine.createSpy import { HEROES_DATA } from './mockup-data' const HEROES_SERVICE_DATA = HEROES_DATA.slice() export class HeroServiceStub { getHero = createSpy('getHero').and.callFake(() => Promise.resolve(Object.assign({}, HEROES_SERVICE_DATA[0])) ) getHeroes = createSpy('getHeroes').and.callFake(() => Promise.resolve(HEROES_SERVICE_DATA.slice()) ) create = createSpy('create').and.callFake((name: string) => { HEROES_SERVICE_DATA.push({ id: 100, name }) return Promise.resolve(HEROES_SERVICE_DATA) }) }
import createSpy = jasmine.createSpy import { Hero } from './hero' import { HEROES_DATA } from './mockup-data' export class HeroServiceStub { private heroes: Hero[] getHero = createSpy('getHero').and.callFake(() => Promise.resolve(Object.assign({}, this.heroes[0])) ) getHeroes = createSpy('getHeroes').and.callFake(() => Promise.resolve(this.heroes.slice()) ) create = createSpy('create').and.callFake((name: string) => { this.heroes.push({ id: 100, name }) return Promise.resolve(this.heroes) }) remove = createSpy('remove').and.callFake((hero: Hero) => { this.heroes = this.heroes.filter(h => h.id !== hero.id) return Promise.resolve(this.heroes) }) constructor() { this.heroes = [...HEROES_DATA] } }
Add remove method and localize heroes data
Add remove method and localize heroes data
TypeScript
mit
hckhanh/tour-of-heroes,hckhanh/tour-of-heroes,hckhanh/tour-of-heroes
--- +++ @@ -1,19 +1,29 @@ import createSpy = jasmine.createSpy +import { Hero } from './hero' import { HEROES_DATA } from './mockup-data' -const HEROES_SERVICE_DATA = HEROES_DATA.slice() +export class HeroServiceStub { + private heroes: Hero[] -export class HeroServiceStub { getHero = createSpy('getHero').and.callFake(() => - Promise.resolve(Object.assign({}, HEROES_SERVICE_DATA[0])) + Promise.resolve(Object.assign({}, this.heroes[0])) ) getHeroes = createSpy('getHeroes').and.callFake(() => - Promise.resolve(HEROES_SERVICE_DATA.slice()) + Promise.resolve(this.heroes.slice()) ) create = createSpy('create').and.callFake((name: string) => { - HEROES_SERVICE_DATA.push({ id: 100, name }) - return Promise.resolve(HEROES_SERVICE_DATA) + this.heroes.push({ id: 100, name }) + return Promise.resolve(this.heroes) }) + + remove = createSpy('remove').and.callFake((hero: Hero) => { + this.heroes = this.heroes.filter(h => h.id !== hero.id) + return Promise.resolve(this.heroes) + }) + + constructor() { + this.heroes = [...HEROES_DATA] + } }
37b82edde653475467be8be8d5908a2fbc0e4fc4
bliski_publikator/angular2/src/app/services/csrf.service.ts
bliski_publikator/angular2/src/app/services/csrf.service.ts
import { Injectable } from 'angular2/core'; @Injectable(); export class CsrfService{ constructor() {} getToken() { return this.parseCookie()['csrftoken']; } private parseCookie() { return document.cookie .split(';') .map(t => t.split('=')) .reduce((v, t) => { v[t[0]] = (t[1] || ''); return v }, {}) } }
import { Injectable } from 'angular2/core'; @Injectable(); export class CsrfService{ constructor() {} getToken() { let cookies = this.parseCookie(); let r = cookies['csrftoken']; return r; } private parseCookie() { var cookies = {} document.cookie .split(';') .map(t => t.trim()) .map(t => t.split('=')) .forEach((t) => cookies[t[0]] = (t[1] || '')); return cookies; } }
Fix cookies parser for Google Chrome
Fix cookies parser for Google Chrome
TypeScript
mit
watchdogpolska/bliski_publikator,watchdogpolska/bliski_publikator,watchdogpolska/bliski_publikator,watchdogpolska/bliski_publikator
--- +++ @@ -6,13 +6,18 @@ constructor() {} getToken() { - return this.parseCookie()['csrftoken']; + let cookies = this.parseCookie(); + let r = cookies['csrftoken']; + return r; } private parseCookie() { - return document.cookie + var cookies = {} + document.cookie .split(';') + .map(t => t.trim()) .map(t => t.split('=')) - .reduce((v, t) => { v[t[0]] = (t[1] || ''); return v }, {}) + .forEach((t) => cookies[t[0]] = (t[1] || '')); + return cookies; } }
318ffe56e12106e277c172bd52dcc921b8cca768
new-client/src/components/ImageModal.tsx
new-client/src/components/ImageModal.tsx
import React, { FunctionComponent } from 'react'; import { ModalHeader, ModalCloseButton, ModalBody, ModalFooter, Image, Text, Flex, Link } from '@chakra-ui/react'; interface ImageModalProps { src: string; } const ImageModal: FunctionComponent<ImageModalProps> = ({ src }: ImageModalProps) => { return ( <> <ModalHeader>Image</ModalHeader> <ModalCloseButton /> <ModalBody> <Flex height="100%" alignItems="center"> <Image flex="1" maxHeight="100%" objectFit="scale-down" src={src} /> </Flex> </ModalBody> <ModalFooter justifyContent="center"> <Text fontSize="sm"> <Link href={src}>{src}</Link> </Text> </ModalFooter> </> ); }; export default ImageModal;
import React, { FunctionComponent, useRef } from 'react'; import { ModalHeader, ModalCloseButton, ModalBody, ModalFooter, Image, Text, Flex, Link } from '@chakra-ui/react'; import useResizeObserver from 'use-resize-observer'; interface ImageModalProps { src: string; } const ImageModal: FunctionComponent<ImageModalProps> = ({ src }: ImageModalProps) => { const placeholder = useRef<HTMLDivElement>(null); const { width = 0, height = 0 } = useResizeObserver<HTMLDivElement>({ ref: placeholder }); return ( <> <ModalHeader>Image</ModalHeader> <ModalCloseButton /> <ModalBody ref={placeholder}> <Flex position="absolute" width={width} height={height} alignItems="center" justifyContent="center"> <Image maxHeight="100%" objectFit="scale-down" src={src} /> </Flex> </ModalBody> <ModalFooter justifyContent="center"> <Text fontSize="sm"> <Link href={src}>{src}</Link> </Text> </ModalFooter> </> ); }; export default ImageModal;
Fix image size in preview
Fix image size in preview
TypeScript
apache-2.0
ilkkao/mas,ilkkao/mas,ilkkao/mas,ilkkao/mas
--- +++ @@ -1,18 +1,22 @@ -import React, { FunctionComponent } from 'react'; +import React, { FunctionComponent, useRef } from 'react'; import { ModalHeader, ModalCloseButton, ModalBody, ModalFooter, Image, Text, Flex, Link } from '@chakra-ui/react'; +import useResizeObserver from 'use-resize-observer'; interface ImageModalProps { src: string; } const ImageModal: FunctionComponent<ImageModalProps> = ({ src }: ImageModalProps) => { + const placeholder = useRef<HTMLDivElement>(null); + const { width = 0, height = 0 } = useResizeObserver<HTMLDivElement>({ ref: placeholder }); + return ( <> <ModalHeader>Image</ModalHeader> <ModalCloseButton /> - <ModalBody> - <Flex height="100%" alignItems="center"> - <Image flex="1" maxHeight="100%" objectFit="scale-down" src={src} /> + <ModalBody ref={placeholder}> + <Flex position="absolute" width={width} height={height} alignItems="center" justifyContent="center"> + <Image maxHeight="100%" objectFit="scale-down" src={src} /> </Flex> </ModalBody> <ModalFooter justifyContent="center">
4445ba93ee7cba5271fc4889286911f3e42bcaa3
src/VueJsTypeScriptAspNetCoreSample/src/components/Hello.ts
src/VueJsTypeScriptAspNetCoreSample/src/components/Hello.ts
import * as Vue from "vue"; import Component from "vue-class-component"; @Component({ name: "Hello", }) export default class Hello extends Vue { msg: string = "Welcome to Your Vue.js App"; // created (): void { // axios // .get('/api/hello') // .then((res) => { // this.msg = res.data.message // }) // .catch((ex) => console.log(ex)) // } }
import * as Vue from "vue"; import Component from "vue-class-component"; import axios from "axios"; @Component({ name: "Hello", }) export default class Hello extends Vue { msg: string = "Welcome to Your Vue.js App"; created (): void { axios .get("/api/hello") .then((res) => { this.msg = res.data.message; }) .catch((ex) => console.log(ex)) } }
Add AJAX call sample using axios
Add AJAX call sample using axios
TypeScript
mit
devkimchi/Vue.js-with-ASP.NET-Core-Sample,devkimchi/Vue.js-with-ASP.NET-Core-Sample,devkimchi/Vue.js-with-ASP.NET-Core-Sample,devkimchi/Vue.js-with-ASP.NET-Core-Sample
--- +++ @@ -1,17 +1,18 @@ import * as Vue from "vue"; import Component from "vue-class-component"; +import axios from "axios"; @Component({ name: "Hello", }) export default class Hello extends Vue { msg: string = "Welcome to Your Vue.js App"; -// created (): void { -// axios -// .get('/api/hello') -// .then((res) => { -// this.msg = res.data.message -// }) -// .catch((ex) => console.log(ex)) -// } + created (): void { + axios + .get("/api/hello") + .then((res) => { + this.msg = res.data.message; + }) + .catch((ex) => console.log(ex)) + } }
4134926195e4cf6b109c72daf698da4d4f298411
src/app/annotator/annotator.component.ts
src/app/annotator/annotator.component.ts
import { Component } from '@angular/core'; import { Router } from '@angular/router'; @Component({ selector: 'annotator', templateUrl: './annotator.component.html', styleUrls: ['./annotator.component.css'], }) export class AnnotatorComponent { constructor( public router: Router, ) { } actionBack(): void { this.router.navigate(['./dataview']); } getClip(): any { //return this.alveoService.audioData; return null; } getClipName(): string { return ""; } }
import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { AlveoService } from '../alveo/shared/alveo.service'; @Component({ selector: 'annotator', templateUrl: './annotator.component.html', styleUrls: ['./annotator.component.css'], }) export class AnnotatorComponent { constructor( public router: Router, public alveoService: AlveoService, ) { } actionBack(): void { this.router.navigate(['./dataview']); } getClip(): any { return this.alveoService.audioData; } getClipName(): string { return ""; } }
Call audioData from Alveo module (for now)
Call audioData from Alveo module (for now)
TypeScript
bsd-3-clause
Alveo/alveo-transcriber,Alveo/alveo-transcriber,Alveo/alveo-transcriber,Alveo/alveo-transcriber
--- +++ @@ -1,5 +1,7 @@ import { Component } from '@angular/core'; import { Router } from '@angular/router'; + +import { AlveoService } from '../alveo/shared/alveo.service'; @Component({ selector: 'annotator', @@ -10,6 +12,7 @@ export class AnnotatorComponent { constructor( public router: Router, + public alveoService: AlveoService, ) { } actionBack(): void { @@ -17,8 +20,7 @@ } getClip(): any { - //return this.alveoService.audioData; - return null; + return this.alveoService.audioData; } getClipName(): string {
d72dae9b8baf0fd211a71c83720cdec57488aaa8
src/lib/Components/Bidding/Components/BackButton.tsx
src/lib/Components/Bidding/Components/BackButton.tsx
import React from "react" import { TouchableWithoutFeedback, ViewProperties } from "react-native" import NavigatorIOS from "react-native-navigator-ios" import { Image } from "../Elements/Image" import { theme } from "../Elements/Theme" interface ContainerWithBackButtonProps extends ViewProperties { navigator: NavigatorIOS } export class BackButton extends React.Component<ContainerWithBackButtonProps> { goBack() { this.props.navigator.pop() } render() { return ( <TouchableWithoutFeedback onPress={() => this.goBack()}> <Image position="absolute" top={theme.space[3]} left={theme.space[3]} source={require("../../../../../images/angle-left.png")} style={{ zIndex: 10 }} // Here the style prop is intentionally used to avoid making zIndex too handy. /> </TouchableWithoutFeedback> ) } }
import React from "react" import { TouchableWithoutFeedback, ViewProperties } from "react-native" import NavigatorIOS from "react-native-navigator-ios" import { Image } from "../Elements/Image" interface ContainerWithBackButtonProps extends ViewProperties { navigator: NavigatorIOS } export class BackButton extends React.Component<ContainerWithBackButtonProps> { goBack() { this.props.navigator.pop() } render() { return ( <TouchableWithoutFeedback onPress={() => this.goBack()}> <Image position="absolute" top={"14px"} left={3} source={require("../../../../../images/angle-left.png")} style={{ zIndex: 10 }} // Here the style prop is intentionally used to avoid making zIndex too handy. /> </TouchableWithoutFeedback> ) } }
Adjust bid registration back button spacing
Adjust bid registration back button spacing
TypeScript
mit
artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen
--- +++ @@ -2,7 +2,6 @@ import { TouchableWithoutFeedback, ViewProperties } from "react-native" import NavigatorIOS from "react-native-navigator-ios" import { Image } from "../Elements/Image" -import { theme } from "../Elements/Theme" interface ContainerWithBackButtonProps extends ViewProperties { navigator: NavigatorIOS @@ -18,8 +17,8 @@ <TouchableWithoutFeedback onPress={() => this.goBack()}> <Image position="absolute" - top={theme.space[3]} - left={theme.space[3]} + top={"14px"} + left={3} source={require("../../../../../images/angle-left.png")} style={{ zIndex: 10 }} // Here the style prop is intentionally used to avoid making zIndex too handy. />
d4a0f2027e9bd72ac9de9dcefd04b4f0bd319f9d
src/helpers/readers.ts
src/helpers/readers.ts
import * as fs from 'fs'; import * as jsyaml from 'js-yaml'; export function readTypeIDs(path): Object { return jsyaml.load(fs.readFileSync(path).toString()); } export function readToken(path): string { return fs.readFileSync(path).toString(); }
import * as fs from 'fs'; import * as jsyaml from 'js-yaml'; export function readTypeIDs(path): Object { return jsyaml.load(fs.readFileSync(path).toString()); } export function readToken(path): string { return fs.readFileSync(path).toString().trim(); }
Fix crash when token.txt contains a newline
Fix crash when token.txt contains a newline
TypeScript
mit
Ionaru/MarketBot
--- +++ @@ -6,5 +6,5 @@ } export function readToken(path): string { - return fs.readFileSync(path).toString(); + return fs.readFileSync(path).toString().trim(); }
ed291560d73a15b8bb802db11c44358b73f898e6
src/containers/TopContainer.ts
src/containers/TopContainer.ts
import * as _ from 'lodash'; import {connect} from 'react-redux'; import Top from '../components/Top'; import {closeAllTask, openAllTask, sync, updateCommonConfig} from '../actions/index'; import RootState from '../states/index'; import CommonConfig from '../models/CommonConfig'; const mapStateToProps = (state: RootState) => ({ tasks: _.values(state.app.tasksById), projects: state.app.projects, labels: state.app.labels, config: state.config.common, error: state.app.error, isLoading: state.app.isSyncing, isAllTaskOpen: state.app.isAllTaskOpen, }); const mapDispatchToProps = (dispatch, ownProps) => { return { onReload: () => { dispatch(sync()) }, onChangeConfig: (config: CommonConfig) => { dispatch(updateCommonConfig(config)); }, openAllTask: () => { dispatch(openAllTask()) }, closeAllTask: () => { dispatch(closeAllTask()) } } }; const TopContainer = connect( mapStateToProps, mapDispatchToProps )(Top); export default TopContainer;
import * as _ from 'lodash'; import {connect} from 'react-redux'; import Top from '../components/Top'; import {closeAllTask, openAllTask, sync, updateCommonConfig, updateTasks} from '../actions/index'; import RootState from '../states/index'; import CommonConfig from '../models/CommonConfig'; import {TaskUpdateParameter} from '../models/Task'; const mapStateToProps = (state: RootState) => ({ tasks: _.values(state.app.tasksById), projects: state.app.projects, labels: state.app.labels, config: state.config.common, error: state.app.error, isLoading: state.app.isSyncing, isAllTaskOpen: state.app.isAllTaskOpen, }); const mapDispatchToProps = (dispatch, ownProps) => { return { onReload: () => { dispatch(sync()) }, onChangeConfig: (config: CommonConfig) => { dispatch(updateCommonConfig(config)); }, onUpdateTask: (parameter: TaskUpdateParameter) => { dispatch(updateTasks([parameter])); }, openAllTask: () => { dispatch(openAllTask()) }, closeAllTask: () => { dispatch(closeAllTask()) } } }; const TopContainer = connect( mapStateToProps, mapDispatchToProps )(Top); export default TopContainer;
Fix not working drag and drop
:skull: Fix not working drag and drop
TypeScript
mit
tadashi-aikawa/owlora,tadashi-aikawa/owlora,tadashi-aikawa/owlora
--- +++ @@ -1,9 +1,10 @@ import * as _ from 'lodash'; import {connect} from 'react-redux'; import Top from '../components/Top'; -import {closeAllTask, openAllTask, sync, updateCommonConfig} from '../actions/index'; +import {closeAllTask, openAllTask, sync, updateCommonConfig, updateTasks} from '../actions/index'; import RootState from '../states/index'; import CommonConfig from '../models/CommonConfig'; +import {TaskUpdateParameter} from '../models/Task'; const mapStateToProps = (state: RootState) => ({ tasks: _.values(state.app.tasksById), @@ -23,6 +24,9 @@ onChangeConfig: (config: CommonConfig) => { dispatch(updateCommonConfig(config)); }, + onUpdateTask: (parameter: TaskUpdateParameter) => { + dispatch(updateTasks([parameter])); + }, openAllTask: () => { dispatch(openAllTask()) },
9eccb86b6f34abd145ebb9b107787953a8bc0adb
lib/utils/calculate-grid-points.ts
lib/utils/calculate-grid-points.ts
import lonlat from '@conveyal/lonlat' import {PROJECTION_ZOOM_LEVEL} from 'lib/constants' export default function calculateGridPoints( bounds: CL.Bounds, zoom = PROJECTION_ZOOM_LEVEL ): number { const topLeft = lonlat.toPixel([bounds.west, bounds.north], zoom) const bottomRight = lonlat.toPixel([bounds.east, bounds.south], zoom) const width = topLeft.x - bottomRight.x const height = topLeft.y - bottomRight.y return width * height }
import lonlat from '@conveyal/lonlat' import {PROJECTION_ZOOM_LEVEL} from 'lib/constants' /** * The grid extent is computed from the points. If the cell number for the right edge of the grid is rounded * down, some points could fall outside the grid. `lonlat.toPixel` and `lonlat.toPixel` naturally truncate down, which is * the correct behavior for binning points into cells but means the grid is (almost) always 1 row too * narrow/short, so we add 1 to the height and width when a grid is created in this manner. */ export default function calculateGridPoints( bounds: CL.Bounds, zoom = PROJECTION_ZOOM_LEVEL ): number { const topLeft = lonlat.toPixel([bounds.west, bounds.north], zoom) const bottomRight = lonlat.toPixel([bounds.east, bounds.south], zoom) const width = topLeft.x - bottomRight.x + 1 const height = topLeft.y - bottomRight.y + 1 return width * height }
Add 1 to width and height
Add 1 to width and height Match what's being done on the backend
TypeScript
mit
conveyal/analysis-ui,conveyal/analysis-ui,conveyal/analysis-ui
--- +++ @@ -2,13 +2,19 @@ import {PROJECTION_ZOOM_LEVEL} from 'lib/constants' +/** + * The grid extent is computed from the points. If the cell number for the right edge of the grid is rounded + * down, some points could fall outside the grid. `lonlat.toPixel` and `lonlat.toPixel` naturally truncate down, which is + * the correct behavior for binning points into cells but means the grid is (almost) always 1 row too + * narrow/short, so we add 1 to the height and width when a grid is created in this manner. + */ export default function calculateGridPoints( bounds: CL.Bounds, zoom = PROJECTION_ZOOM_LEVEL ): number { const topLeft = lonlat.toPixel([bounds.west, bounds.north], zoom) const bottomRight = lonlat.toPixel([bounds.east, bounds.south], zoom) - const width = topLeft.x - bottomRight.x - const height = topLeft.y - bottomRight.y + const width = topLeft.x - bottomRight.x + 1 + const height = topLeft.y - bottomRight.y + 1 return width * height }
562fdbba10ad9af369a099704fc5187cffca7eee
lib/nativescript-cli.ts
lib/nativescript-cli.ts
///<reference path=".d.ts"/> "use strict"; // this call must be first to avoid requiring c++ dependencies require("./common/verify-node-version").verifyNodeVersion(require("../package.json").engines.node); require("./bootstrap"); import * as fiber from "fibers"; import Future = require("fibers/future"); import * as shelljs from "shelljs"; shelljs.config.silent = true; import {installUncaughtExceptionListener} from "./common/errors"; installUncaughtExceptionListener(process.exit); fiber(() => { let config: Config.IConfig = $injector.resolve("$config"); let err: IErrors = $injector.resolve("$errors"); err.printCallStack = config.DEBUG; let commandDispatcher: ICommandDispatcher = $injector.resolve("commandDispatcher"); let messages: IMessagesService = $injector.resolve("$messagesService"); messages.pathsToMessageJsonFiles = [/* Place client-specific json message file paths here */]; if (process.argv[2] === "completion") { commandDispatcher.completeCommand().wait(); } else { commandDispatcher.dispatchCommand().wait(); } $injector.dispose(); Future.assertNoFutureLeftBehind(); }).run();
///<reference path=".d.ts"/> "use strict"; let node = require("../package.json").engines.node; // this call must be first to avoid requiring c++ dependencies require("./common/verify-node-version").verifyNodeVersion(node, "NativeScript", "2.2.0"); require("./bootstrap"); import * as fiber from "fibers"; import Future = require("fibers/future"); import * as shelljs from "shelljs"; shelljs.config.silent = true; import {installUncaughtExceptionListener} from "./common/errors"; installUncaughtExceptionListener(process.exit); fiber(() => { let config: Config.IConfig = $injector.resolve("$config"); let err: IErrors = $injector.resolve("$errors"); err.printCallStack = config.DEBUG; let commandDispatcher: ICommandDispatcher = $injector.resolve("commandDispatcher"); let messages: IMessagesService = $injector.resolve("$messagesService"); messages.pathsToMessageJsonFiles = [/* Place client-specific json message file paths here */]; if (process.argv[2] === "completion") { commandDispatcher.completeCommand().wait(); } else { commandDispatcher.dispatchCommand().wait(); } $injector.dispose(); Future.assertNoFutureLeftBehind(); }).run();
Add warning for Node.js 0.10.x deprecation
Add warning for Node.js 0.10.x deprecation Warn users that support from version 0.10.x will be removed in version 2.2.0.
TypeScript
apache-2.0
NativeScript/nativescript-cli,tsvetie/nativescript-cli,NativeScript/nativescript-cli,NativeScript/nativescript-cli,NathanaelA/nativescript-cli,NathanaelA/nativescript-cli,NathanaelA/nativescript-cli,tsvetie/nativescript-cli,NativeScript/nativescript-cli,tsvetie/nativescript-cli,tsvetie/nativescript-cli,NathanaelA/nativescript-cli,tsvetie/nativescript-cli
--- +++ @@ -1,8 +1,9 @@ ///<reference path=".d.ts"/> "use strict"; +let node = require("../package.json").engines.node; // this call must be first to avoid requiring c++ dependencies -require("./common/verify-node-version").verifyNodeVersion(require("../package.json").engines.node); +require("./common/verify-node-version").verifyNodeVersion(node, "NativeScript", "2.2.0"); require("./bootstrap"); import * as fiber from "fibers";
ebb54db9419301b1af9522db77f46da8f2a0b05a
client/src/app/services/status.service.ts
client/src/app/services/status.service.ts
/* * Copyright (c) 2017 Bonnie Schulkin. All Rights Reserved. * * This file is part of BoxCharter. * * BoxCharter is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * BoxCharter is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License * for more details. * * You should have received a copy of the GNU Affero General Public License * along with BoxCharter. If not, see <http://www.gnu.org/licenses/>. * */ /* This service maintains a common Status object among components. */ import { Injectable } from '@angular/core'; import { Status, statusStrings } from '../model/status' @Injectable() export class StatusService { public status: Status = null; constructor() { } setStatus(statusResponse: Status): void { this.status = statusResponse; } clearStatus(): void { // clear the status data this.status = null; } clearSuccess(): void { // clear the status only if it's a success status if (this.status && this.status.success()) { this.status = null; } } }
/* * Copyright (c) 2017 Bonnie Schulkin. All Rights Reserved. * * This file is part of BoxCharter. * * BoxCharter is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * BoxCharter is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License * for more details. * * You should have received a copy of the GNU Affero General Public License * along with BoxCharter. If not, see <http://www.gnu.org/licenses/>. * */ /* This service maintains a common Status object among components. */ import { Injectable } from '@angular/core'; import { Status, statusStrings } from '../model/status' @Injectable() export class StatusService { public status: Status = null; constructor() { } setStatus(statusResponse: Status): void { // TODO: scroll up to where status is, so user sees it. // TODO: animate status // TODO: make status disappear after (10) seconds this.status = statusResponse; } clearStatus(): void { // clear the status data this.status = null; } clearSuccess(): void { // clear the status only if it's a success status if (this.status && this.status.success()) { this.status = null; } } }
Add TODOs to make status display more elegant and useful.
Add TODOs to make status display more elegant and useful.
TypeScript
agpl-3.0
flyrightsister/boxcharter,flyrightsister/boxcharter
--- +++ @@ -31,6 +31,9 @@ constructor() { } setStatus(statusResponse: Status): void { + // TODO: scroll up to where status is, so user sees it. + // TODO: animate status + // TODO: make status disappear after (10) seconds this.status = statusResponse; }
4fde183a6ae218751829d85d3b0bc2f0f7977034
test/helpers/fast-test-setup.ts
test/helpers/fast-test-setup.ts
import { ComponentFixture, getTestBed, TestBed } from '@angular/core/testing'; /** * Sources from: * https://github.com/topnotch48/ng-bullet-workspace * https://blog.angularindepth.com/angular-unit-testing-performance-34363b7345ba * * @example * describe('Testing Something.', () => { * fastTestSetup(); * * let fixture: ComponentFixture<SomethingComponent>; * * beforeAll(async () => { * await TestBed.configureTestingModule({ * declarations: [SomethingComponent], * }) * .compileComponents(); * }); * * it('...'); * }); */ export function fastTestSetup(): void { const testBedApi: any = getTestBed(); const originReset = TestBed.resetTestingModule; beforeAll(() => { TestBed.resetTestingModule(); TestBed.resetTestingModule = () => TestBed; }); afterEach(() => { testBedApi._activeFixtures.forEach((fixture: ComponentFixture<any>) => fixture.destroy()); testBedApi._instantiated = false; }); afterAll(() => { TestBed.resetTestingModule = originReset; TestBed.resetTestingModule(); }); }
import { ipcRenderer } from 'electron'; import { ComponentFixture, getTestBed, TestBed } from '@angular/core/testing'; /** * Sources from: * https://github.com/topnotch48/ng-bullet-workspace * https://blog.angularindepth.com/angular-unit-testing-performance-34363b7345ba * * @example * describe('Testing Something.', () => { * fastTestSetup(); * * let fixture: ComponentFixture<SomethingComponent>; * * beforeAll(async () => { * await TestBed.configureTestingModule({ * declarations: [SomethingComponent], * }) * .compileComponents(); * }); * * it('...'); * }); */ export function fastTestSetup(): void { const testBedApi: any = getTestBed(); const originReset = TestBed.resetTestingModule; beforeAll(() => { TestBed.resetTestingModule(); TestBed.resetTestingModule = () => TestBed; }); afterEach(() => { testBedApi._activeFixtures.forEach((fixture: ComponentFixture<any>) => fixture.destroy()); testBedApi._instantiated = false; // Remove all ipc listeners because memory leaks happens if we keep it. // Note that it's not clean and it does not match the subject of this function. // But I dit this things because it could solve the problem effectively. ipcRenderer.removeAllListeners('git'); ipcRenderer.removeAllListeners('workspace'); ipcRenderer.removeAllListeners('menu'); }); afterAll(() => { TestBed.resetTestingModule = originReset; TestBed.resetTestingModule(); }); }
Fix memory leak problem during testing
Fix memory leak problem during testing
TypeScript
mit
seokju-na/geeks-diary,seokju-na/geeks-diary,seokju-na/geeks-diary
--- +++ @@ -1,3 +1,4 @@ +import { ipcRenderer } from 'electron'; import { ComponentFixture, getTestBed, TestBed } from '@angular/core/testing'; @@ -34,6 +35,13 @@ afterEach(() => { testBedApi._activeFixtures.forEach((fixture: ComponentFixture<any>) => fixture.destroy()); testBedApi._instantiated = false; + + // Remove all ipc listeners because memory leaks happens if we keep it. + // Note that it's not clean and it does not match the subject of this function. + // But I dit this things because it could solve the problem effectively. + ipcRenderer.removeAllListeners('git'); + ipcRenderer.removeAllListeners('workspace'); + ipcRenderer.removeAllListeners('menu'); }); afterAll(() => {
9ac8ec74c03ba712d02834ded97ef07be2d99a63
MarkdownConverter/src/System/Tasks/PuppeteerTask.ts
MarkdownConverter/src/System/Tasks/PuppeteerTask.ts
import FileSystem = require("fs-extra"); import Puppeteer = require("puppeteer-core"); import { CancellationToken, Progress } from "vscode"; import { IConvertedFile } from "../../Conversion/IConvertedFile"; import { MarkdownConverterExtension } from "../../MarkdownConverterExtension"; import { ChromiumNotFoundException } from "./ChromiumNotFoundException"; import { IProgressState } from "./IProgressState"; import { Task } from "./Task"; /** * Represents a task which depends on Puppeteer. */ export abstract class PuppeteerTask extends Task<MarkdownConverterExtension> { /** * Initializes a new instance of the `PuppeteerTask` class. * * @param extension * The extension this task belongs to. */ public constructor(extension: MarkdownConverterExtension) { super(extension); } /** * Gets or sets the extension this task belongs to. */ public get Extension() { return super.Extension; } /** * Executes the task. * * @param fileReporter * A component for reporting converted files. */ public async Execute(progressReporter?: Progress<IProgressState>, cancellationToken?: CancellationToken, fileReporter?: Progress<IConvertedFile>) { if (await FileSystem.pathExists(Puppeteer.executablePath())) { await this.ExecuteTask(progressReporter, cancellationToken, fileReporter); } else { throw new ChromiumNotFoundException(); } } /** * Executes the task. */ protected abstract async ExecuteTask(progressReporter?: Progress<IProgressState>, cancellationToken?: CancellationToken, fileReporter?: Progress<IConvertedFile>): Promise<void>; }
import FileSystem = require("fs-extra"); import Puppeteer = require("puppeteer-core"); import { CancellationToken, CancellationTokenSource, Progress } from "vscode"; import { IConvertedFile } from "../../Conversion/IConvertedFile"; import { MarkdownConverterExtension } from "../../MarkdownConverterExtension"; import { ChromiumNotFoundException } from "./ChromiumNotFoundException"; import { IProgressState } from "./IProgressState"; import { Task } from "./Task"; /** * Represents a task which depends on Puppeteer. */ export abstract class PuppeteerTask extends Task<MarkdownConverterExtension> { /** * Initializes a new instance of the `PuppeteerTask` class. * * @param extension * The extension this task belongs to. */ public constructor(extension: MarkdownConverterExtension) { super(extension); } /** * Gets or sets the extension this task belongs to. */ public get Extension() { return super.Extension; } /** * Executes the task. * * @param fileReporter * A component for reporting converted files. */ public async Execute(progressReporter?: Progress<IProgressState>, cancellationToken?: CancellationToken, fileReporter?: Progress<IConvertedFile>) { if (await FileSystem.pathExists(Puppeteer.executablePath())) { await this.ExecuteTask(progressReporter || { report() { } }, cancellationToken || new CancellationTokenSource().token, fileReporter || { report() { } }); } else { throw new ChromiumNotFoundException(); } } /** * Executes the task. */ protected abstract async ExecuteTask(progressReporter?: Progress<IProgressState>, cancellationToken?: CancellationToken, fileReporter?: Progress<IConvertedFile>): Promise<void>; }
Add default parameters for the puppeteer-task
Add default parameters for the puppeteer-task
TypeScript
mit
manuth/MarkdownConverter,manuth/MarkdownConverter,manuth/MarkdownConverter
--- +++ @@ -1,6 +1,6 @@ import FileSystem = require("fs-extra"); import Puppeteer = require("puppeteer-core"); -import { CancellationToken, Progress } from "vscode"; +import { CancellationToken, CancellationTokenSource, Progress } from "vscode"; import { IConvertedFile } from "../../Conversion/IConvertedFile"; import { MarkdownConverterExtension } from "../../MarkdownConverterExtension"; import { ChromiumNotFoundException } from "./ChromiumNotFoundException"; @@ -41,7 +41,7 @@ { if (await FileSystem.pathExists(Puppeteer.executablePath())) { - await this.ExecuteTask(progressReporter, cancellationToken, fileReporter); + await this.ExecuteTask(progressReporter || { report() { } }, cancellationToken || new CancellationTokenSource().token, fileReporter || { report() { } }); } else {
72e04790fd4fb060444eb13cbbd5e72906f703ba
src/main.d.ts
src/main.d.ts
import type { PluginCreator } from 'postcss'; export const cssDeclarationSorter: PluginCreator<{ /** Provide the name of one of the built-in sort orders or a comparison function that is passed to `Array.sort`. @default 'alphabetical' */ order?: SortOrder | SortFunction | undefined; /** To prevent breaking legacy CSS where shorthand declarations override longhand declarations. For example `animation-name: some; animation: greeting;` will be kept in this order. @default false */ keepOverrides?: boolean; }>; type SortOrder = 'alphabetical' | 'concentric-css' | 'smacss'; /** * This function receives two declaration property names and is expected * to return -1, 0 or 1 depending on the wanted order. */ type SortFunction = (propertyNameA: string, propertyNameB: string) => -1 | 0 | 1;
import type { PluginCreator } from 'postcss'; declare const cssDeclarationSorter: PluginCreator<{ /** Provide the name of one of the built-in sort orders or a comparison function that is passed to `Array.sort`. @default 'alphabetical' */ order?: SortOrder | SortFunction | undefined; /** To prevent breaking legacy CSS where shorthand declarations override longhand declarations. For example `animation-name: some; animation: greeting;` will be kept in this order. @default false */ keepOverrides?: boolean; }>; export = cssDeclarationSorter; type SortOrder = 'alphabetical' | 'concentric-css' | 'smacss'; /** * This function receives two declaration property names and is expected * to return -1, 0 or 1 depending on the wanted order. */ type SortFunction = (propertyNameA: string, propertyNameB: string) => -1 | 0 | 1;
Use CommonJS export in types
Use CommonJS export in types
TypeScript
isc
Siilwyn/css-declaration-sorter
--- +++ @@ -1,6 +1,6 @@ import type { PluginCreator } from 'postcss'; -export const cssDeclarationSorter: PluginCreator<{ +declare const cssDeclarationSorter: PluginCreator<{ /** Provide the name of one of the built-in sort orders or a comparison function that is passed to `Array.sort`. @@ -16,6 +16,8 @@ keepOverrides?: boolean; }>; +export = cssDeclarationSorter; + type SortOrder = 'alphabetical' | 'concentric-css' | 'smacss'; /**
d6fa0136b4e6aeafa8f244e04cde8e5d2afa7a9b
src/utils/get-platform.ts
src/utils/get-platform.ts
let platform: any; // return the current platform if there is one, // otherwise open up a new platform export function getPlatform(appId: string, appCode: string) { if (platform) return platform; platform = new H.service.Platform({ 'app_id': appId, 'app_code': appCode, }); return platform; } // make the getPlatform method the default export export default getPlatform;
let platform: any; // return the current platform if there is one, // otherwise open up a new platform export function getPlatform(platformOptions: H.service.Platform.Options) { if (platform) return platform; platform = new H.service.Platform(platformOptions); return platform; } // make the getPlatform method the default export export default getPlatform;
Support all platform options in getPlatform utility.
Support all platform options in getPlatform utility.
TypeScript
mit
Josh-ES/react-here-maps,Josh-ES/react-here-maps
--- +++ @@ -2,13 +2,10 @@ // return the current platform if there is one, // otherwise open up a new platform -export function getPlatform(appId: string, appCode: string) { +export function getPlatform(platformOptions: H.service.Platform.Options) { if (platform) return platform; - platform = new H.service.Platform({ - 'app_id': appId, - 'app_code': appCode, - }); + platform = new H.service.Platform(platformOptions); return platform; }
076796396253a9605ee05ab01657dc21002f1ffa
src/client/app/fassung/fassung-routing.module.ts
src/client/app/fassung/fassung-routing.module.ts
/** * Created by Reto Baumgartner (rfbaumgartner) on 05.07.17. */ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { FassungComponent } from './fassung.component'; @NgModule({ imports: [ RouterModule.forChild([ { path: 'drucke/:konvolut/:fassung', component: FassungComponent }, { path: 'manuskripte/:konvolut/:fassung', component: FassungComponent }, { path: 'notizbuecher/:konvolut/:fassung', component: FassungComponent }, { path: 'typoskripte/typoskripte-sammlungen/:konvolut/:fassung', component: FassungComponent }, { path: 'typoskripte/:konvolut/:fassung', component: FassungComponent }, { path: 'material/:konvolut/:fassung', component: FassungComponent } ]) ], exports: [ RouterModule ] }) export class FassungRoutingModule { }
/** * Created by Reto Baumgartner (rfbaumgartner) on 05.07.17. */ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { FassungComponent } from './fassung.component'; @NgModule({ imports: [ RouterModule.forChild([ { path: 'drucke/:konvolut/:fassung', component: FassungComponent }, { path: 'manuskripte/:konvolut/:fassung', component: FassungComponent }, { path: 'notizbuecher/:konvolut/:fassung', component: FassungComponent }, { path: 'typoskripte/:konvolut/:fassung', component: FassungComponent }, { path: 'material/:konvolut/:fassung', component: FassungComponent } ]) ], exports: [ RouterModule ] }) export class FassungRoutingModule { }
Remove route to special collection `typoskripte-sammlungen`
Remove route to special collection `typoskripte-sammlungen` The collection `typoskripte-sammlungen` serves only as a ordering element in the navigation
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -12,7 +12,6 @@ { path: 'drucke/:konvolut/:fassung', component: FassungComponent }, { path: 'manuskripte/:konvolut/:fassung', component: FassungComponent }, { path: 'notizbuecher/:konvolut/:fassung', component: FassungComponent }, - { path: 'typoskripte/typoskripte-sammlungen/:konvolut/:fassung', component: FassungComponent }, { path: 'typoskripte/:konvolut/:fassung', component: FassungComponent }, { path: 'material/:konvolut/:fassung', component: FassungComponent } ])
fc3f03a161c08e4e0946671305183f1c608f7765
services/QuillLMS/client/app/modules/apollo.ts
services/QuillLMS/client/app/modules/apollo.ts
// import ApolloClient from "apollo-boost"; // const client = new ApolloClient({}); import { ApolloClient } from 'apollo-client'; import { HttpLink } from 'apollo-link-http'; import { InMemoryCache } from 'apollo-cache-inmemory'; import { ApolloLink, concat } from 'apollo-link'; const httpLink = new HttpLink({ uri: '/graphql' }); const authMiddleware = new ApolloLink((operation, forward) => { // add the authorization to the headers operation.setContext({ headers: { 'x-csrf-token': document.getElementsByName('csrf-token')[0] ? document.getElementsByName('csrf-token')[0].content : 0 } }); return forward(operation); }) const client = new ApolloClient({ link: concat(authMiddleware, httpLink), cache: new InMemoryCache(), }); export default client;
// import ApolloClient from "apollo-boost"; // const client = new ApolloClient({}); import { ApolloClient } from 'apollo-client'; import { HttpLink } from 'apollo-link-http'; import { InMemoryCache } from 'apollo-cache-inmemory'; import { ApolloLink, concat } from 'apollo-link'; const httpLink = new HttpLink({ uri: '/graphql' }); const authMiddleware = new ApolloLink((operation, forward) => { // add the authorization to the headers operation.setContext({ headers: { 'x-csrf-token': document.getElementsByName('csrf-token')[0] ? document.getElementsByName('csrf-token')[0].getAttribute('content') : 0 } }); return forward(operation); }) const client = new ApolloClient({ link: concat(authMiddleware, httpLink), cache: new InMemoryCache(), }); export default client;
Fix property 'content' does not exist on type 'HTMLElement'
quill-lms: Fix property 'content' does not exist on type 'HTMLElement' document.getElementsByName() returns a HTMLElement object, which does not have a property 'content'. [0] TypeScript is typesafe, so where returned object HTMLElement does not have a property, any attempted access to it will be invalid. Reported by tslint and [email protected]. There are two potential solutions: - Utilize the generic .getAttribute('content'); or - Cast to the specific subtype (e.g. HTMLMetaElement) [1] which does have a property 'content'. tslint error: ERROR in [at-loader] ./app/modules/apollo.ts:16:113 TS2339: Property 'content' does not exist on type 'HTMLElement'. [0] https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement [1] https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement
TypeScript
agpl-3.0
empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core
--- +++ @@ -13,7 +13,7 @@ // add the authorization to the headers operation.setContext({ headers: { - 'x-csrf-token': document.getElementsByName('csrf-token')[0] ? document.getElementsByName('csrf-token')[0].content : 0 + 'x-csrf-token': document.getElementsByName('csrf-token')[0] ? document.getElementsByName('csrf-token')[0].getAttribute('content') : 0 } });
c67ccf97af318e15b92c50827e256ba9180f3d99
typescript/collections/hash-map.ts
typescript/collections/hash-map.ts
// We will use an array as if it isn't associative export class HashMap<T> { private _arr: T[] = []; set(key: string, val: T): void { const hash = this._hash(key); this._arr[hash] = val; } get(key: string): T | undefined { const hash = this._hash(key); return this._arr[hash]; } // This is not a proper has function! It may result in collisions easily private _hash(key: string): number { return new Array(key.length) .fill(0) .map((_, idx: number) => key.charCodeAt(idx)) .reduce((accum: number, curr: number) => accum += curr >> 2, 0); } // Shows the indices toString(): string { let values = []; for (let i = 0; i < this._arr.length; i+=1) { if (this._arr[i]) { values.push(`[${i}: ${this._arr[i]}]`); } } return `[${values.join(', ')}]`; } } // Demo: const map = new HashMap<string | number>(); map.set('name', 'Georgi'); map.set('age', 1337); map.set('github', 'hawkgs'); console.log(map.get('name')); console.log(map.get('age')); console.log(map.get('github')); console.log(map.toString());
// We will use an array as if it isn't associative export class HashMap<T> { private _arr: T[] = []; set(key: string, val: T): void { const hash = this._hash(key); this._arr[hash] = val; } get(key: string): T | undefined { const hash = this._hash(key); return this._arr[hash]; } // This is not a proper hash function! It may result in collisions easily private _hash(key: string): number { return new Array(key.length) .fill(0) .map((_, idx: number) => key.charCodeAt(idx)) .reduce((accum: number, curr: number) => accum += curr >> 2, 0); } // Shows the indices toString(): string { let values = []; for (let i = 0; i < this._arr.length; i+=1) { if (this._arr[i]) { values.push(`[${i}: ${this._arr[i]}]`); } } return `[${values.join(', ')}]`; } } // Demo: const map = new HashMap<string | number>(); map.set('name', 'Georgi'); map.set('age', 1337); map.set('github', 'hawkgs'); console.log(map.get('name')); console.log(map.get('age')); console.log(map.get('github')); console.log(map.toString());
Fix typo in TS hash map comment
Fix typo in TS hash map comment
TypeScript
mit
hAWKdv/DataStructures,hAWKdv/DataStructures
--- +++ @@ -13,7 +13,7 @@ return this._arr[hash]; } - // This is not a proper has function! It may result in collisions easily + // This is not a proper hash function! It may result in collisions easily private _hash(key: string): number { return new Array(key.length) .fill(0)
c8959e289b8a12f6c5f5f35b672a65f977c3cc09
myFirstApps/src/app/pipe/getImage.pipe.spec.ts
myFirstApps/src/app/pipe/getImage.pipe.spec.ts
import { GetImagePipe } from './getImage.pipe' describe('Testing for GetImagePipe', ()=>{ let pipe: GetImagePipe; beforeEach(()=>{ pipe = new GetImagePipe(); }); it('providing noImagePath if no value of imagePath', ()=>{ expect(pipe.transform('', 'http://localhost/noImage.jpg')) .toBe('http://localhost/noImage.jpg'); }); it('providing ImagePath if has value of imagePath', ()=>{ expect(pipe.transform('http://localhost/image/sample01.jpg', 'http://localhost/noImage.jpg')) .toBe('http://localhost/image/sample01.jpg'); }); it('Changing https if useHttps is true', ()=>{ expect(pipe.transform('http://localhost/image/sample01.jpg', 'http://localhost/noImage.jpg', true)) .toBe('https://localhost/image/sample01.jpg'); }); })
Add unit test for GetImage pipe
Add unit test for GetImage pipe
TypeScript
mit
fedorax/angular-basic,fedorax/angular-basic,fedorax/angular-basic
--- +++ @@ -0,0 +1,25 @@ +import { GetImagePipe } from './getImage.pipe' + +describe('Testing for GetImagePipe', ()=>{ + let pipe: GetImagePipe; + + beforeEach(()=>{ + pipe = new GetImagePipe(); + }); + + it('providing noImagePath if no value of imagePath', ()=>{ + expect(pipe.transform('', 'http://localhost/noImage.jpg')) + .toBe('http://localhost/noImage.jpg'); + }); + + it('providing ImagePath if has value of imagePath', ()=>{ + expect(pipe.transform('http://localhost/image/sample01.jpg', 'http://localhost/noImage.jpg')) + .toBe('http://localhost/image/sample01.jpg'); + }); + + it('Changing https if useHttps is true', ()=>{ + expect(pipe.transform('http://localhost/image/sample01.jpg', 'http://localhost/noImage.jpg', true)) + .toBe('https://localhost/image/sample01.jpg'); + }); + +})
19c6bc0fe056a2430b0530d16bbf980a14b7b65b
test/e2e/console/console-eval-global_test.ts
test/e2e/console/console-eval-global_test.ts
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {assert} from 'chai'; import {describe, it} from 'mocha'; import {click, getBrowserAndPages, pasteText, step} from '../../shared/helper.js'; import {CONSOLE_TAB_SELECTOR, focusConsolePrompt} from '../helpers/console-helpers.js'; import {getCurrentConsoleMessages} from '../helpers/console-helpers.js'; describe('The Console Tab', async () => { it('interacts with the global scope correctly', async () => { const {frontend} = getBrowserAndPages(); await step('navigate to the Console tab', async () => { await click(CONSOLE_TAB_SELECTOR); await focusConsolePrompt(); }); await step('enter code that implicitly creates global properties', async () => { await pasteText(` var foo = 'fooValue'; var bar = { a: 'b', }; `); await frontend.keyboard.press('Enter'); // Wait for the console to be usable again. await frontend.waitForFunction(() => { return document.querySelectorAll('.console-user-command-result').length === 1; }); }); await step('enter code that references the created bindings', async () => { await pasteText('foo;'); await frontend.keyboard.press('Enter'); // Wait for the console to be usable again. await frontend.waitForFunction(() => { return document.querySelectorAll('.console-user-command-result').length === 1; }); await pasteText('bar;'); await frontend.keyboard.press('Enter'); }); await step('check that the expected output is logged', async () => { const messages = await getCurrentConsoleMessages(); assert.deepEqual(messages, [ 'undefined', '"fooValue"', '{a: "b"}', ]); }); }); });
Add e2e test for global evaluation in Console
Add e2e test for global evaluation in Console This patch ports the following layout test: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/http/tests/devtools/console/console-eval-global.js;drc=78e2bc9c2def358a0745878ffc66ce85ee5221d8 CL removing the upstream test: https://chromium-review.googlesource.com/c/chromium/src/+/2270179 Bug: chromium:1099603 Change-Id: I7560e9e85b83ac864f19c6da92acd46045ed5c0c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2270163 Reviewed-by: Peter Marshall <[email protected]> Commit-Queue: Mathias Bynens <[email protected]>
TypeScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -0,0 +1,58 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {assert} from 'chai'; +import {describe, it} from 'mocha'; + +import {click, getBrowserAndPages, pasteText, step} from '../../shared/helper.js'; +import {CONSOLE_TAB_SELECTOR, focusConsolePrompt} from '../helpers/console-helpers.js'; +import {getCurrentConsoleMessages} from '../helpers/console-helpers.js'; + +describe('The Console Tab', async () => { + it('interacts with the global scope correctly', async () => { + const {frontend} = getBrowserAndPages(); + + await step('navigate to the Console tab', async () => { + await click(CONSOLE_TAB_SELECTOR); + await focusConsolePrompt(); + }); + + await step('enter code that implicitly creates global properties', async () => { + await pasteText(` + var foo = 'fooValue'; + var bar = { + a: 'b', + }; + `); + await frontend.keyboard.press('Enter'); + + // Wait for the console to be usable again. + await frontend.waitForFunction(() => { + return document.querySelectorAll('.console-user-command-result').length === 1; + }); + }); + + await step('enter code that references the created bindings', async () => { + await pasteText('foo;'); + await frontend.keyboard.press('Enter'); + + // Wait for the console to be usable again. + await frontend.waitForFunction(() => { + return document.querySelectorAll('.console-user-command-result').length === 1; + }); + + await pasteText('bar;'); + await frontend.keyboard.press('Enter'); + }); + + await step('check that the expected output is logged', async () => { + const messages = await getCurrentConsoleMessages(); + assert.deepEqual(messages, [ + 'undefined', + '"fooValue"', + '{a: "b"}', + ]); + }); + }); +});
3c2c992a1b785ab9b6cfa3ae0d9f082683c291c0
src/System/Documents/Assets/PictureSource.ts
src/System/Documents/Assets/PictureSource.ts
import { dirname, extname } from "path"; import { Document } from "../Document"; import { Asset } from "./Asset"; import { AssetURLType } from "./AssetURLType"; import { InsertionType } from "./InsertionType"; /** * Represents the source of a picture. */ export class PictureSource extends Asset { /** * The document of the picture. */ private document: Document; /** * Initializes a new instance of the {@link PictureSource `PictureSource`} class. * * @param document * The document of the asset. * * @param path * The path to the asset. * * @param insertionType * The type of the insertion of the picture. */ public constructor(document: Document, path: string, insertionType?: InsertionType) { super(path, insertionType); this.document = document; } /** * Gets the document of the picture. */ public get Document(): Document { return this.document; } /** * @inheritdoc */ public override get DocRoot(): string { return this.Document.FileName ? dirname(this.Document.FileName) : null; } /** * @inheritdoc * * @returns * The type of the insertion of the picture. */ protected override GetInsertionType(): InsertionType { if (this.InsertionType === InsertionType.Default) { return InsertionType.Link; } else { return super.GetInsertionType(); } } /** * Gets the inline-source of the picture. * * @returns * The inline-source of the picture. */ protected async GetSource(): Promise<string> { if (this.URLType === AssetURLType.RelativePath && !this.DocRoot) { return this.GetReferenceSource(); } else { let fileExtension = extname(this.URL).slice(1); let typeName: string; if (fileExtension === "jpg") { typeName = "jpeg"; } else if (fileExtension === "svg") { typeName = fileExtension + "+xml"; } else { typeName = fileExtension; } return `data:image/${typeName};base64,${(await this.ReadFile()).toString("base64")}`; } } /** * Gets the reference-expression of the picture. * * @returns * The reference-expression of the picture. */ protected async GetReferenceSource(): Promise<string> { return this.URL; } }
Add a class for representing the source-value of a picture
Add a class for representing the source-value of a picture
TypeScript
mit
manuth/MarkdownConverter,manuth/MarkdownConverter,manuth/MarkdownConverter
--- +++ @@ -0,0 +1,113 @@ +import { dirname, extname } from "path"; +import { Document } from "../Document"; +import { Asset } from "./Asset"; +import { AssetURLType } from "./AssetURLType"; +import { InsertionType } from "./InsertionType"; + +/** + * Represents the source of a picture. + */ +export class PictureSource extends Asset +{ + /** + * The document of the picture. + */ + private document: Document; + + /** + * Initializes a new instance of the {@link PictureSource `PictureSource`} class. + * + * @param document + * The document of the asset. + * + * @param path + * The path to the asset. + * + * @param insertionType + * The type of the insertion of the picture. + */ + public constructor(document: Document, path: string, insertionType?: InsertionType) + { + super(path, insertionType); + this.document = document; + } + + /** + * Gets the document of the picture. + */ + public get Document(): Document + { + return this.document; + } + + /** + * @inheritdoc + */ + public override get DocRoot(): string + { + return this.Document.FileName ? dirname(this.Document.FileName) : null; + } + + /** + * @inheritdoc + * + * @returns + * The type of the insertion of the picture. + */ + protected override GetInsertionType(): InsertionType + { + if (this.InsertionType === InsertionType.Default) + { + return InsertionType.Link; + } + else + { + return super.GetInsertionType(); + } + } + + /** + * Gets the inline-source of the picture. + * + * @returns + * The inline-source of the picture. + */ + protected async GetSource(): Promise<string> + { + if (this.URLType === AssetURLType.RelativePath && !this.DocRoot) + { + return this.GetReferenceSource(); + } + else + { + let fileExtension = extname(this.URL).slice(1); + let typeName: string; + + if (fileExtension === "jpg") + { + typeName = "jpeg"; + } + else if (fileExtension === "svg") + { + typeName = fileExtension + "+xml"; + } + else + { + typeName = fileExtension; + } + + return `data:image/${typeName};base64,${(await this.ReadFile()).toString("base64")}`; + } + } + + /** + * Gets the reference-expression of the picture. + * + * @returns + * The reference-expression of the picture. + */ + protected async GetReferenceSource(): Promise<string> + { + return this.URL; + } +}
92806a890fa78a8e9ad455d5bedf14cb9bd7259f
src/Parsing/Outline/ParseDescriptionList.ts
src/Parsing/Outline/ParseDescriptionList.ts
import { TextConsumer } from '../TextConsumer' import { UnorderedListNode } from '../../SyntaxNodes/UnorderedListNode' import { UnorderedListItemNode } from '../../SyntaxNodes/UnorderedListItemNode' import { DescriptionListNode } from '../../SyntaxNodes/DescriptionListNode' import { DescriptionTermNode } from '../../SyntaxNodes/DescriptionTermNode' import { DescriptionNode } from '../../SyntaxNodes/DescriptionNode' import { LineNode } from '../../SyntaxNodes/LineNode' import { getOutlineNodes } from './GetOutlineNodes' import { optional, startsWith, either, NON_BLANK, BLANK, INDENT, STREAK } from './Patterns' import { last } from '../CollectionHelpers' import { OutlineParser, OutlineParserArgs, } from './OutlineParser' const NON_BLANK_PATTERN = new RegExp( NON_BLANK ) const BLANK_PATTERN = new RegExp( BLANK ) const INDENTED_PATTERN = new RegExp( startsWith(INDENT) ) /* // Description lists are collections of terms and descriptions. // // Terms are left-aligned; descriptions are indented and directly follow the corresponding terms. // // A single description can be associated with multiple terms. export function parseDescriptionList(args: OutlineParserArgs): boolean { const consumer = new TextConsumer(args.text) const listItemsContents: string[] = [] while (!consumer.done()) { let listItemLines: string[] = [] const isLineBulleted = consumer.consumeLine({ pattern: BULLET_PATTERN, if: (line) => !STREAK_PATTERN.test(line), then: (line) => listItemLines.push(line.replace(BULLET_PATTERN, '')) }) if (!isLineBulleted) { break } // Let's collect the rest of this list item (i.e. the next block of indented or blank lines). while (!consumer.done()) { const isLineIndented = consumer.consumeLine({ pattern: INDENTED_PATTERN, then: (line) => listItemLines.push(line.replace(INDENTED_PATTERN, '')) }) if (isLineIndented) { continue } const isLineBlank = consumer.consumeLine({ pattern: BLANK_PATTERN, then: (line) => listItemLines.push(line) }) if (!isLineBlank) { // Well, the line was neither indented nor blank. That means it's either the start of // another list item, or it's the first line following the list. Let's leave this inner // loop and find out which. break } } // This loses the final newline, but trailing blank lines are always ignored when parsing for // outline conventions, which is exactly what we're going to do next. listItemsContents.push(listItemLines.join('\n')) } if (!listItemsContents.length) { return false } const listNode = new UnorderedListNode() // Parse each list item like its own mini-document for (const listItemContents of listItemsContents) { listNode.addChild( new UnorderedListItemNode(getOutlineNodes(listItemContents)) ) } args.then([listNode], consumer.lengthConsumed()) return true } */
Add description list parser file
Add description list parser file
TypeScript
mit
start/up,start/up
--- +++ @@ -0,0 +1,96 @@ +import { TextConsumer } from '../TextConsumer' +import { UnorderedListNode } from '../../SyntaxNodes/UnorderedListNode' +import { UnorderedListItemNode } from '../../SyntaxNodes/UnorderedListItemNode' +import { DescriptionListNode } from '../../SyntaxNodes/DescriptionListNode' +import { DescriptionTermNode } from '../../SyntaxNodes/DescriptionTermNode' +import { DescriptionNode } from '../../SyntaxNodes/DescriptionNode' +import { LineNode } from '../../SyntaxNodes/LineNode' +import { getOutlineNodes } from './GetOutlineNodes' +import { optional, startsWith, either, NON_BLANK, BLANK, INDENT, STREAK } from './Patterns' +import { last } from '../CollectionHelpers' +import { OutlineParser, OutlineParserArgs, } from './OutlineParser' + +const NON_BLANK_PATTERN = new RegExp( + NON_BLANK +) + +const BLANK_PATTERN = new RegExp( + BLANK +) + +const INDENTED_PATTERN = new RegExp( + startsWith(INDENT) +) + +/* + +// Description lists are collections of terms and descriptions. +// +// Terms are left-aligned; descriptions are indented and directly follow the corresponding terms. +// +// A single description can be associated with multiple terms. +export function parseDescriptionList(args: OutlineParserArgs): boolean { + const consumer = new TextConsumer(args.text) + const listItemsContents: string[] = [] + + while (!consumer.done()) { + let listItemLines: string[] = [] + + const isLineBulleted = consumer.consumeLine({ + pattern: BULLET_PATTERN, + if: (line) => !STREAK_PATTERN.test(line), + then: (line) => listItemLines.push(line.replace(BULLET_PATTERN, '')) + }) + + if (!isLineBulleted) { + break + } + + // Let's collect the rest of this list item (i.e. the next block of indented or blank lines). + while (!consumer.done()) { + + const isLineIndented = consumer.consumeLine({ + pattern: INDENTED_PATTERN, + then: (line) => listItemLines.push(line.replace(INDENTED_PATTERN, '')) + }) + + if (isLineIndented) { + continue + } + + const isLineBlank = consumer.consumeLine({ + pattern: BLANK_PATTERN, + then: (line) => listItemLines.push(line) + }) + + if (!isLineBlank) { + // Well, the line was neither indented nor blank. That means it's either the start of + // another list item, or it's the first line following the list. Let's leave this inner + // loop and find out which. + break + } + } + + // This loses the final newline, but trailing blank lines are always ignored when parsing for + // outline conventions, which is exactly what we're going to do next. + listItemsContents.push(listItemLines.join('\n')) + } + + if (!listItemsContents.length) { + return false + } + + const listNode = new UnorderedListNode() + + // Parse each list item like its own mini-document + for (const listItemContents of listItemsContents) { + listNode.addChild( + new UnorderedListItemNode(getOutlineNodes(listItemContents)) + ) + } + + args.then([listNode], consumer.lengthConsumed()) + return true +} + +*/
57888a3a478e3cb0d0cb10c778f794df99c0a1af
minimist/minimist-tests.ts
minimist/minimist-tests.ts
/// <reference path="minimist.d.ts" /> import minimist = require('minimist'); import Opts = minimist.Opts; var num: string; var str: string; var strArr: string[]; var args: string[]; var obj: minimist.ParsedArgs; var opts: Opts; var arg: any; opts.string = str; opts.string = strArr; opts.boolean = true; opts.boolean = str; opts.boolean = strArr; opts.alias = { foo: strArr }; opts.default = { foo: str }; opts.default = { foo: num }; opts.unknown = (arg: string) => { if(/xyz/.test(arg)){ return true; } return false; }; opts.stopEarly = true; opts['--'] = true; obj = minimist(); obj = minimist(strArr); obj = minimist(strArr, opts); var remainingArgCount = obj._.length; arg = obj['foo'];
/// <reference path="minimist.d.ts" /> import minimist = require('minimist'); import Opts = minimist.Opts; var num: string; var str: string; var strArr: string[]; var args: string[]; var obj: minimist.ParsedArgs; var opts: Opts; var arg: any; opts.string = str; opts.string = strArr; opts.boolean = true; opts.boolean = str; opts.boolean = strArr; opts.alias = { foo: strArr }; opts.alias = { foo: str }; opts.default = { foo: str }; opts.default = { foo: num }; opts.unknown = (arg: string) => { if(/xyz/.test(arg)){ return true; } return false; }; opts.stopEarly = true; opts['--'] = true; obj = minimist(); obj = minimist(strArr); obj = minimist(strArr, opts); var remainingArgCount = obj._.length; arg = obj['foo'];
Add test for alias with single string value
Add test for alias with single string value
TypeScript
mit
slavomirvojacek/DefinitelyTyped,onecentlin/DefinitelyTyped,jasonswearingen/DefinitelyTyped,chrootsu/DefinitelyTyped,gandjustas/DefinitelyTyped,wilfrem/DefinitelyTyped,johan-gorter/DefinitelyTyped,musicist288/DefinitelyTyped,Zzzen/DefinitelyTyped,magny/DefinitelyTyped,johan-gorter/DefinitelyTyped,benliddicott/DefinitelyTyped,applesaucers/lodash-invokeMap,AbraaoAlves/DefinitelyTyped,use-strict/DefinitelyTyped,zuzusik/DefinitelyTyped,aciccarello/DefinitelyTyped,nainslie/DefinitelyTyped,nycdotnet/DefinitelyTyped,pwelter34/DefinitelyTyped,rschmukler/DefinitelyTyped,emanuelhp/DefinitelyTyped,smrq/DefinitelyTyped,QuatroCode/DefinitelyTyped,stacktracejs/DefinitelyTyped,minodisk/DefinitelyTyped,isman-usoh/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,onecentlin/DefinitelyTyped,zuzusik/DefinitelyTyped,martinduparc/DefinitelyTyped,dsebastien/DefinitelyTyped,flyfishMT/DefinitelyTyped,jimthedev/DefinitelyTyped,OpenMaths/DefinitelyTyped,raijinsetsu/DefinitelyTyped,glenndierckx/DefinitelyTyped,martinduparc/DefinitelyTyped,glenndierckx/DefinitelyTyped,yuit/DefinitelyTyped,philippstucki/DefinitelyTyped,gandjustas/DefinitelyTyped,pwelter34/DefinitelyTyped,daptiv/DefinitelyTyped,amanmahajan7/DefinitelyTyped,hellopao/DefinitelyTyped,jraymakers/DefinitelyTyped,abner/DefinitelyTyped,rcchen/DefinitelyTyped,eugenpodaru/DefinitelyTyped,Ptival/DefinitelyTyped,isman-usoh/DefinitelyTyped,borisyankov/DefinitelyTyped,benishouga/DefinitelyTyped,hellopao/DefinitelyTyped,HPFOD/DefinitelyTyped,YousefED/DefinitelyTyped,progre/DefinitelyTyped,raijinsetsu/DefinitelyTyped,greglo/DefinitelyTyped,markogresak/DefinitelyTyped,arusakov/DefinitelyTyped,alextkachman/DefinitelyTyped,sledorze/DefinitelyTyped,damianog/DefinitelyTyped,alexdresko/DefinitelyTyped,HPFOD/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,nycdotnet/DefinitelyTyped,arusakov/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,pocesar/DefinitelyTyped,ashwinr/DefinitelyTyped,UzEE/DefinitelyTyped,mattblang/DefinitelyTyped,yuit/DefinitelyTyped,aciccarello/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,optical/DefinitelyTyped,sclausen/DefinitelyTyped,micurs/DefinitelyTyped,sclausen/DefinitelyTyped,syuilo/DefinitelyTyped,wilfrem/DefinitelyTyped,Litee/DefinitelyTyped,newclear/DefinitelyTyped,danfma/DefinitelyTyped,psnider/DefinitelyTyped,applesaucers/lodash-invokeMap,nainslie/DefinitelyTyped,OpenMaths/DefinitelyTyped,scriby/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,frogcjn/DefinitelyTyped,Litee/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,Ptival/DefinitelyTyped,bennett000/DefinitelyTyped,zuzusik/DefinitelyTyped,tan9/DefinitelyTyped,mhegazy/DefinitelyTyped,nakakura/DefinitelyTyped,chbrown/DefinitelyTyped,schmuli/DefinitelyTyped,paulmorphy/DefinitelyTyped,donnut/DefinitelyTyped,sledorze/DefinitelyTyped,mattblang/DefinitelyTyped,jraymakers/DefinitelyTyped,subash-a/DefinitelyTyped,optical/DefinitelyTyped,alvarorahul/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,arma-gast/DefinitelyTyped,aciccarello/DefinitelyTyped,Zorgatone/DefinitelyTyped,YousefED/DefinitelyTyped,nfriend/DefinitelyTyped,mareek/DefinitelyTyped,jimthedev/DefinitelyTyped,newclear/DefinitelyTyped,abner/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,scriby/DefinitelyTyped,smrq/DefinitelyTyped,benishouga/DefinitelyTyped,stephenjelfs/DefinitelyTyped,reppners/DefinitelyTyped,philippstucki/DefinitelyTyped,EnableSoftware/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,nakakura/DefinitelyTyped,xStrom/DefinitelyTyped,trystanclarke/DefinitelyTyped,pocesar/DefinitelyTyped,Dashlane/DefinitelyTyped,EnableSoftware/DefinitelyTyped,tan9/DefinitelyTyped,rolandzwaga/DefinitelyTyped,paulmorphy/DefinitelyTyped,MugeSo/DefinitelyTyped,stephenjelfs/DefinitelyTyped,behzad888/DefinitelyTyped,AgentME/DefinitelyTyped,Penryn/DefinitelyTyped,georgemarshall/DefinitelyTyped,gcastre/DefinitelyTyped,shlomiassaf/DefinitelyTyped,chrootsu/DefinitelyTyped,AgentME/DefinitelyTyped,bennett000/DefinitelyTyped,vagarenko/DefinitelyTyped,arusakov/DefinitelyTyped,abbasmhd/DefinitelyTyped,Pro/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,UzEE/DefinitelyTyped,minodisk/DefinitelyTyped,progre/DefinitelyTyped,syuilo/DefinitelyTyped,chrismbarr/DefinitelyTyped,trystanclarke/DefinitelyTyped,ashwinr/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,arma-gast/DefinitelyTyped,use-strict/DefinitelyTyped,mcrawshaw/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,Dashlane/DefinitelyTyped,nitintutlani/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,Dominator008/DefinitelyTyped,Dominator008/DefinitelyTyped,rcchen/DefinitelyTyped,Zzzen/DefinitelyTyped,behzad888/DefinitelyTyped,RX14/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,alvarorahul/DefinitelyTyped,nobuoka/DefinitelyTyped,jimthedev/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,mcrawshaw/DefinitelyTyped,greglo/DefinitelyTyped,alexdresko/DefinitelyTyped,flyfishMT/DefinitelyTyped,dsebastien/DefinitelyTyped,ryan10132/DefinitelyTyped,psnider/DefinitelyTyped,axelcostaspena/DefinitelyTyped,martinduparc/DefinitelyTyped,esperco/DefinitelyTyped,frogcjn/DefinitelyTyped,danfma/DefinitelyTyped,stacktracejs/DefinitelyTyped,nobuoka/DefinitelyTyped,schmuli/DefinitelyTyped,gcastre/DefinitelyTyped,Zorgatone/DefinitelyTyped,benishouga/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,jasonswearingen/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,hellopao/DefinitelyTyped,chrismbarr/DefinitelyTyped,AgentME/DefinitelyTyped,mcliment/DefinitelyTyped,xStrom/DefinitelyTyped,shlomiassaf/DefinitelyTyped,florentpoujol/DefinitelyTyped,QuatroCode/DefinitelyTyped,magny/DefinitelyTyped,vagarenko/DefinitelyTyped,subash-a/DefinitelyTyped,rolandzwaga/DefinitelyTyped,MugeSo/DefinitelyTyped,mareek/DefinitelyTyped,Penryn/DefinitelyTyped,esperco/DefinitelyTyped,nitintutlani/DefinitelyTyped,georgemarshall/DefinitelyTyped,florentpoujol/DefinitelyTyped,damianog/DefinitelyTyped,RX14/DefinitelyTyped,pocesar/DefinitelyTyped,mhegazy/DefinitelyTyped,Pro/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,amir-arad/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,donnut/DefinitelyTyped,psnider/DefinitelyTyped,AgentME/DefinitelyTyped,schmuli/DefinitelyTyped,borisyankov/DefinitelyTyped,abbasmhd/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,one-pieces/DefinitelyTyped,alextkachman/DefinitelyTyped,reppners/DefinitelyTyped,amanmahajan7/DefinitelyTyped,emanuelhp/DefinitelyTyped,rschmukler/DefinitelyTyped,GlennQuirynen/DefinitelyTyped
--- +++ @@ -19,6 +19,9 @@ opts.alias = { foo: strArr }; +opts.alias = { + foo: str +}; opts.default = { foo: str }; @@ -29,7 +32,7 @@ if(/xyz/.test(arg)){ return true; } - + return false; }; opts.stopEarly = true;
f42b6590f984423ef98d2187712788e77ea05dc5
saleor/static/dashboard-next/storybook/Decorator.tsx
saleor/static/dashboard-next/storybook/Decorator.tsx
import * as React from "react"; import AppActionContext from "../components/AppLayout/AppActionContext"; import { Provider as DateProvider } from "../components/Date/DateContext"; import { FormProvider } from "../components/Form"; import { MessageManager } from "../components/messages"; import ThemeProvider from "../components/Theme"; import { TimezoneProvider } from "../components/Timezone"; const DecoratorComponent: React.FC<{ story: any }> = ({ story }) => { const appActionAnchor = React.useRef<HTMLDivElement>(); return ( <FormProvider> <DateProvider value={+new Date("2018-08-07T14:30:44+00:00")}> <TimezoneProvider value="America/New_York"> <ThemeProvider isDefaultDark={false}> <MessageManager> <AppActionContext.Provider value={appActionAnchor}> <div style={{ display: "flex", flexGrow: 1, padding: 24 }} > <div style={{ flexGrow: 1 }}>{story}</div> </div> <div style={{ bottom: 0, gridColumn: 2, position: "sticky" }} ref={appActionAnchor} /> </AppActionContext.Provider> </MessageManager> </ThemeProvider> </TimezoneProvider> </DateProvider> </FormProvider> ); }; export const Decorator = storyFn => <DecoratorComponent story={storyFn()} />; export default Decorator;
import * as React from "react"; import { Provider as DateProvider } from "../components/Date/DateContext"; import { FormProvider } from "../components/Form"; import { MessageManager } from "../components/messages"; import ThemeProvider from "../components/Theme"; import { TimezoneProvider } from "../components/Timezone"; export const Decorator = storyFn => ( <FormProvider> <DateProvider value={+new Date("2018-08-07T14:30:44+00:00")}> <TimezoneProvider value="America/New_York"> <ThemeProvider isDefaultDark={false}> <MessageManager> <div style={{ padding: 24 }} > {storyFn()} </div> </MessageManager> </ThemeProvider> </TimezoneProvider> </DateProvider> </FormProvider> ); export default Decorator;
Revert changes made to decorator
Revert changes made to decorator
TypeScript
bsd-3-clause
maferelo/saleor,mociepka/saleor,mociepka/saleor,maferelo/saleor,mociepka/saleor,maferelo/saleor
--- +++ @@ -1,46 +1,28 @@ import * as React from "react"; -import AppActionContext from "../components/AppLayout/AppActionContext"; import { Provider as DateProvider } from "../components/Date/DateContext"; import { FormProvider } from "../components/Form"; import { MessageManager } from "../components/messages"; import ThemeProvider from "../components/Theme"; import { TimezoneProvider } from "../components/Timezone"; -const DecoratorComponent: React.FC<{ story: any }> = ({ story }) => { - const appActionAnchor = React.useRef<HTMLDivElement>(); - - return ( - <FormProvider> - <DateProvider value={+new Date("2018-08-07T14:30:44+00:00")}> - <TimezoneProvider value="America/New_York"> - <ThemeProvider isDefaultDark={false}> - <MessageManager> - <AppActionContext.Provider value={appActionAnchor}> - <div - style={{ - display: "flex", - flexGrow: 1, - padding: 24 - }} - > - <div style={{ flexGrow: 1 }}>{story}</div> - </div> - <div - style={{ - bottom: 0, - gridColumn: 2, - position: "sticky" - }} - ref={appActionAnchor} - /> - </AppActionContext.Provider> - </MessageManager> - </ThemeProvider> - </TimezoneProvider> - </DateProvider> - </FormProvider> - ); -}; -export const Decorator = storyFn => <DecoratorComponent story={storyFn()} />; +export const Decorator = storyFn => ( + <FormProvider> + <DateProvider value={+new Date("2018-08-07T14:30:44+00:00")}> + <TimezoneProvider value="America/New_York"> + <ThemeProvider isDefaultDark={false}> + <MessageManager> + <div + style={{ + padding: 24 + }} + > + {storyFn()} + </div> + </MessageManager> + </ThemeProvider> + </TimezoneProvider> + </DateProvider> + </FormProvider> +); export default Decorator;
605baa5cb44469c9bd6d2caa70b6b9812d500224
tether-drop/tether-drop-tests.ts
tether-drop/tether-drop-tests.ts
///<reference path="../tether/tether.d.ts" /> ///<reference path="tether-drop.d.ts" /> import 'tether-drop'; var yellowBox = document.querySelector(".yellow"); var greenBox = document.querySelector(".green"); var d = new Drop({ position: "bottom left", openOn: "click", constrainToWindow: true, constrainToScrollParent: true, classes: "", tetherOptions: {}, remove: true, target: yellowBox, content: greenBox }); d.open(); d.close(); d.remove(); d.toggle(); d.position(); d.destroy(); d.drop.appendChild(document.createElement("div")); d.tether.position(); d.on("open", () => false); d.on("close", () => false); d.once("close", () => false); d.off("close", () => false); d.off("open"); var e = new Drop({ target: yellowBox, content: () => greenBox }); var Tooltip = Drop.createContext({ classPrefix: 'tooltip' }); var t = new Tooltip({ target: yellowBox, content: () => greenBox });
///<reference path="../tether/tether.d.ts" /> ///<reference path="tether-drop.d.ts" /> import 'tether-drop'; var yellowBox = document.querySelector(".yellow"); var greenBox = document.querySelector(".green"); var d = new Drop({ position: "bottom left", openOn: "click", constrainToWindow: true, constrainToScrollParent: true, classes: "", tetherOptions: {}, remove: true, target: yellowBox, content: greenBox }); d.open(); d.close(); d.remove(); d.toggle(); d.position(); d.destroy(); d.content.appendChild(document.createElement("div")); d.tether.position(); d.on("open", () => false); d.on("close", () => false); d.once("close", () => false); d.off("close", () => false); d.off("open"); var e = new Drop({ target: yellowBox, content: () => greenBox }); var Tooltip = Drop.createContext({ classPrefix: 'tooltip' }); var t = new Tooltip({ target: yellowBox, content: () => greenBox });
Fix test containing 'drop' property
[tether-drop] Fix test containing 'drop' property
TypeScript
mit
psnider/DefinitelyTyped,AgentME/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,abner/DefinitelyTyped,martinduparc/DefinitelyTyped,abner/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,slavomirvojacek/DefinitelyTyped,daptiv/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,Penryn/DefinitelyTyped,arusakov/DefinitelyTyped,abbasmhd/DefinitelyTyped,Penryn/DefinitelyTyped,use-strict/DefinitelyTyped,shlomiassaf/DefinitelyTyped,micurs/DefinitelyTyped,alexdresko/DefinitelyTyped,magny/DefinitelyTyped,syuilo/DefinitelyTyped,benliddicott/DefinitelyTyped,sledorze/DefinitelyTyped,benishouga/DefinitelyTyped,zuzusik/DefinitelyTyped,jimthedev/DefinitelyTyped,aciccarello/DefinitelyTyped,jimthedev/DefinitelyTyped,YousefED/DefinitelyTyped,HPFOD/DefinitelyTyped,martinduparc/DefinitelyTyped,alvarorahul/DefinitelyTyped,minodisk/DefinitelyTyped,pocesar/DefinitelyTyped,scriby/DefinitelyTyped,johan-gorter/DefinitelyTyped,schmuli/DefinitelyTyped,arma-gast/DefinitelyTyped,gandjustas/DefinitelyTyped,chrootsu/DefinitelyTyped,arusakov/DefinitelyTyped,use-strict/DefinitelyTyped,HPFOD/DefinitelyTyped,martinduparc/DefinitelyTyped,rolandzwaga/DefinitelyTyped,chrismbarr/DefinitelyTyped,dsebastien/DefinitelyTyped,psnider/DefinitelyTyped,mcliment/DefinitelyTyped,YousefED/DefinitelyTyped,benishouga/DefinitelyTyped,aciccarello/DefinitelyTyped,sledorze/DefinitelyTyped,shlomiassaf/DefinitelyTyped,AgentME/DefinitelyTyped,danfma/DefinitelyTyped,zuzusik/DefinitelyTyped,syuilo/DefinitelyTyped,georgemarshall/DefinitelyTyped,aciccarello/DefinitelyTyped,arusakov/DefinitelyTyped,rolandzwaga/DefinitelyTyped,AgentME/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,rcchen/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,johan-gorter/DefinitelyTyped,progre/DefinitelyTyped,subash-a/DefinitelyTyped,dsebastien/DefinitelyTyped,damianog/DefinitelyTyped,QuatroCode/DefinitelyTyped,smrq/DefinitelyTyped,amir-arad/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,magny/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,pocesar/DefinitelyTyped,zuzusik/DefinitelyTyped,benishouga/DefinitelyTyped,minodisk/DefinitelyTyped,pocesar/DefinitelyTyped,abbasmhd/DefinitelyTyped,one-pieces/DefinitelyTyped,nycdotnet/DefinitelyTyped,schmuli/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,chrootsu/DefinitelyTyped,danfma/DefinitelyTyped,subash-a/DefinitelyTyped,hellopao/DefinitelyTyped,alexdresko/DefinitelyTyped,yuit/DefinitelyTyped,mcrawshaw/DefinitelyTyped,scriby/DefinitelyTyped,gandjustas/DefinitelyTyped,AgentME/DefinitelyTyped,xStrom/DefinitelyTyped,damianog/DefinitelyTyped,QuatroCode/DefinitelyTyped,alvarorahul/DefinitelyTyped,hellopao/DefinitelyTyped,xStrom/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,psnider/DefinitelyTyped,nycdotnet/DefinitelyTyped,schmuli/DefinitelyTyped,rcchen/DefinitelyTyped,hellopao/DefinitelyTyped,smrq/DefinitelyTyped,ashwinr/DefinitelyTyped,isman-usoh/DefinitelyTyped,mcrawshaw/DefinitelyTyped,chrismbarr/DefinitelyTyped,progre/DefinitelyTyped,yuit/DefinitelyTyped,markogresak/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,jimthedev/DefinitelyTyped,arma-gast/DefinitelyTyped,isman-usoh/DefinitelyTyped,georgemarshall/DefinitelyTyped,ashwinr/DefinitelyTyped
--- +++ @@ -24,7 +24,7 @@ d.toggle(); d.position(); d.destroy(); -d.drop.appendChild(document.createElement("div")); +d.content.appendChild(document.createElement("div")); d.tether.position(); d.on("open", () => false);
b3078f265ee65c0538d80e11173a327625817523
tests/cases/fourslash/quickInfoForShorthandProperty.ts
tests/cases/fourslash/quickInfoForShorthandProperty.ts
/// <reference path='fourslash.ts' /> //// var name1 = undefined, id1 = undefined; //// var /*obj1*/obj1 = {/*name1*/name1, /*id1*/id1}; //// var name2 = "Hello"; //// var id2 = 10000; //// var /*obj2*/obj2 = {/*name2*/name2, /*id2*/id2}; goTo.marker("obj1"); verify.quickInfoIs("(var) obj1: {\n name1: any;\n id1: any;\n}"); goTo.marker("name1"); verify.quickInfoIs("(property) name1: any"); goTo.marker("id1"); verify.quickInfoIs("(property) id1: any"); goTo.marker("obj2"); verify.quickInfoIs("(var) obj2: {\n name2: string;\n id2: number;\n}"); goTo.marker("name2"); verify.quickInfoIs("(property) name2: string"); goTo.marker("id2"); verify.quickInfoIs("(property) id2: number");
Add a test for quick-info
Add a test for quick-info
TypeScript
apache-2.0
matthewjh/TypeScript,pcan/TypeScript,suto/TypeScript,RReverser/TypeScript,mihailik/TypeScript,ionux/TypeScript,fabioparra/TypeScript,zmaruo/TypeScript,webhost/TypeScript,mihailik/TypeScript,enginekit/TypeScript,moander/TypeScript,SaschaNaz/TypeScript,mszczepaniak/TypeScript,enginekit/TypeScript,thr0w/Thr0wScript,ionux/TypeScript,shanexu/TypeScript,impinball/TypeScript,kimamula/TypeScript,ropik/TypeScript,DanielRosenwasser/TypeScript,Viromo/TypeScript,kingland/TypeScript,Viromo/TypeScript,mauricionr/TypeScript,TukekeSoft/TypeScript,erikmcc/TypeScript,moander/TypeScript,basarat/TypeScript,JohnZ622/TypeScript,jdavidberger/TypeScript,yazeng/TypeScript,SaschaNaz/TypeScript,chocolatechipui/TypeScript,suto/TypeScript,hoanhtien/TypeScript,mauricionr/TypeScript,fearthecowboy/TypeScript,shovon/TypeScript,thr0w/Thr0wScript,minestarks/TypeScript,webhost/TypeScript,fearthecowboy/TypeScript,jdavidberger/TypeScript,pcan/TypeScript,donaldpipowitch/TypeScript,progre/TypeScript,jamesrmccallum/TypeScript,MartyIX/TypeScript,synaptek/TypeScript,samuelhorwitz/typescript,chocolatechipui/TypeScript,mmoskal/TypeScript,plantain-00/TypeScript,ionux/TypeScript,plantain-00/TypeScript,rodrigues-daniel/TypeScript,sassson/TypeScript,zhengbli/TypeScript,HereSinceres/TypeScript,moander/TypeScript,kpreisser/TypeScript,DanielRosenwasser/TypeScript,alexeagle/TypeScript,ZLJASON/TypeScript,DanielRosenwasser/TypeScript,Raynos/TypeScript,RReverser/TypeScript,vilic/TypeScript,zmaruo/TypeScript,basarat/TypeScript,nycdotnet/TypeScript,jdavidberger/TypeScript,sassson/TypeScript,vilic/TypeScript,ziacik/TypeScript,fdecampredon/jsx-typescript,Microsoft/TypeScript,jeremyepling/TypeScript,shovon/TypeScript,vilic/TypeScript,thr0w/Thr0wScript,weswigham/TypeScript,ziacik/TypeScript,bpowers/TypeScript,abbasmhd/TypeScript,msynk/TypeScript,HereSinceres/TypeScript,rgbkrk/TypeScript,mszczepaniak/TypeScript,MartyIX/TypeScript,chuckjaz/TypeScript,DLehenbauer/TypeScript,fdecampredon/jsx-typescript,MartyIX/TypeScript,impinball/TypeScript,abbasmhd/TypeScript,Raynos/TypeScript,kimamula/TypeScript,billti/TypeScript,jwbay/TypeScript,mszczepaniak/TypeScript,weswigham/TypeScript,OlegDokuka/TypeScript,evgrud/TypeScript,germ13/TypeScript,mauricionr/TypeScript,mihailik/TypeScript,rgbkrk/TypeScript,yukulele/TypeScript,abbasmhd/TypeScript,nycdotnet/TypeScript,zhengbli/TypeScript,tinganho/TypeScript,germ13/TypeScript,erikmcc/TypeScript,RReverser/TypeScript,Viromo/TypeScript,vilic/TypeScript,hitesh97/TypeScript,yazeng/TypeScript,TukekeSoft/TypeScript,yortus/TypeScript,SimoneGianni/TypeScript,kingland/TypeScript,SmallAiTT/TypeScript,tempbottle/TypeScript,kpreisser/TypeScript,RyanCavanaugh/TypeScript,mmoskal/TypeScript,ropik/TypeScript,mcanthony/TypeScript,erikmcc/TypeScript,Raynos/TypeScript,yukulele/TypeScript,HereSinceres/TypeScript,jeremyepling/TypeScript,SmallAiTT/TypeScript,zmaruo/TypeScript,erikmcc/TypeScript,AbubakerB/TypeScript,OlegDokuka/TypeScript,weswigham/TypeScript,mcanthony/TypeScript,fabioparra/TypeScript,Microsoft/TypeScript,progre/TypeScript,nagyistoce/TypeScript,samuelhorwitz/typescript,mmoskal/TypeScript,sassson/TypeScript,kumikumi/TypeScript,moander/TypeScript,blakeembrey/TypeScript,shiftkey/TypeScript,basarat/TypeScript,enginekit/TypeScript,microsoft/TypeScript,TukekeSoft/TypeScript,nojvek/TypeScript,billti/TypeScript,chocolatechipui/TypeScript,SimoneGianni/TypeScript,evgrud/TypeScript,RyanCavanaugh/TypeScript,fabioparra/TypeScript,donaldpipowitch/TypeScript,mmoskal/TypeScript,rodrigues-daniel/TypeScript,tinganho/TypeScript,kimamula/TypeScript,RyanCavanaugh/TypeScript,Mqgh2013/TypeScript,evgrud/TypeScript,ionux/TypeScript,donaldpipowitch/TypeScript,tempbottle/TypeScript,minestarks/TypeScript,nojvek/TypeScript,suto/TypeScript,bpowers/TypeScript,Mqgh2013/TypeScript,keir-rex/TypeScript,nagyistoce/TypeScript,germ13/TypeScript,ZLJASON/TypeScript,tempbottle/TypeScript,chuckjaz/TypeScript,shanexu/TypeScript,shovon/TypeScript,kimamula/TypeScript,DanielRosenwasser/TypeScript,evgrud/TypeScript,kingland/TypeScript,ropik/TypeScript,impinball/TypeScript,fdecampredon/jsx-typescript,minestarks/TypeScript,jwbay/TypeScript,Viromo/TypeScript,DLehenbauer/TypeScript,jbondc/TypeScript,plantain-00/TypeScript,JohnZ622/TypeScript,jamesrmccallum/TypeScript,ZLJASON/TypeScript,nojvek/TypeScript,SimoneGianni/TypeScript,hoanhtien/TypeScript,alexeagle/TypeScript,blakeembrey/TypeScript,JohnZ622/TypeScript,gdi2290/TypeScript,blakeembrey/TypeScript,nycdotnet/TypeScript,Mqgh2013/TypeScript,yukulele/TypeScript,microsoft/TypeScript,samuelhorwitz/typescript,alexeagle/TypeScript,Eyas/TypeScript,shiftkey/TypeScript,Raynos/TypeScript,rgbkrk/TypeScript,matthewjh/TypeScript,progre/TypeScript,hitesh97/TypeScript,shanexu/TypeScript,billti/TypeScript,fearthecowboy/TypeScript,yazeng/TypeScript,Eyas/TypeScript,kitsonk/TypeScript,AbubakerB/TypeScript,synaptek/TypeScript,plantain-00/TypeScript,SaschaNaz/TypeScript,jbondc/TypeScript,kitsonk/TypeScript,fdecampredon/jsx-typescript,DLehenbauer/TypeScript,kitsonk/TypeScript,blakeembrey/TypeScript,thr0w/Thr0wScript,jamesrmccallum/TypeScript,mcanthony/TypeScript,hoanhtien/TypeScript,rodrigues-daniel/TypeScript,MartyIX/TypeScript,donaldpipowitch/TypeScript,keir-rex/TypeScript,basarat/TypeScript,chuckjaz/TypeScript,mihailik/TypeScript,webhost/TypeScript,zhengbli/TypeScript,jteplitz602/TypeScript,tinganho/TypeScript,AbubakerB/TypeScript,rodrigues-daniel/TypeScript,kpreisser/TypeScript,ziacik/TypeScript,OlegDokuka/TypeScript,nycdotnet/TypeScript,jteplitz602/TypeScript,synaptek/TypeScript,kumikumi/TypeScript,keir-rex/TypeScript,yortus/TypeScript,SmallAiTT/TypeScript,pcan/TypeScript,hitesh97/TypeScript,chuckjaz/TypeScript,msynk/TypeScript,AbubakerB/TypeScript,shanexu/TypeScript,microsoft/TypeScript,mcanthony/TypeScript,Microsoft/TypeScript,nagyistoce/TypeScript,fabioparra/TypeScript,SaschaNaz/TypeScript,jteplitz602/TypeScript,yortus/TypeScript,yortus/TypeScript,samuelhorwitz/typescript,matthewjh/TypeScript,JohnZ622/TypeScript,Eyas/TypeScript,ropik/TypeScript,DLehenbauer/TypeScript,shiftkey/TypeScript,gonifade/TypeScript,bpowers/TypeScript,ziacik/TypeScript,jeremyepling/TypeScript,jwbay/TypeScript,synaptek/TypeScript,jwbay/TypeScript,nojvek/TypeScript,Eyas/TypeScript,kumikumi/TypeScript,gonifade/TypeScript,gonifade/TypeScript,mauricionr/TypeScript,msynk/TypeScript,jbondc/TypeScript
--- +++ @@ -0,0 +1,21 @@ +/// <reference path='fourslash.ts' /> + +//// var name1 = undefined, id1 = undefined; +//// var /*obj1*/obj1 = {/*name1*/name1, /*id1*/id1}; +//// var name2 = "Hello"; +//// var id2 = 10000; +//// var /*obj2*/obj2 = {/*name2*/name2, /*id2*/id2}; + +goTo.marker("obj1"); +verify.quickInfoIs("(var) obj1: {\n name1: any;\n id1: any;\n}"); +goTo.marker("name1"); +verify.quickInfoIs("(property) name1: any"); +goTo.marker("id1"); +verify.quickInfoIs("(property) id1: any"); + +goTo.marker("obj2"); +verify.quickInfoIs("(var) obj2: {\n name2: string;\n id2: number;\n}"); +goTo.marker("name2"); +verify.quickInfoIs("(property) name2: string"); +goTo.marker("id2"); +verify.quickInfoIs("(property) id2: number");
37503183f6f27bcde42d8bf38f89ff6a8085a3c8
src/Test/Ast/CurlyBracketed.ts
src/Test/Ast/CurlyBracketed.ts
import { expect } from 'chai' import Up from '../../index' import { insideDocumentAndParagraph } from './Helpers' import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode' import { CurlyBracketedNode } from '../../SyntaxNodes/CurlyBracketedNode' describe('Text surrounded by curly brackets', () => { it('is put inside a curly bracketed node with the curly brackets preserved as plain text', () => { expect(Up.toAst('I like {certain types of} pizza')).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('I like '), new CurlyBracketedNode([ new PlainTextNode('{certain types of}') ]), new PlainTextNode(' pizza') ])) }) }) describe('curly bracketed text', () => { it('is evaluated for other conventions', () => { expect(Up.toAst('I like {certain *types* of} pizza')).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('I like '), new CurlyBracketedNode([ new PlainTextNode('{certain '), new EmphasisNode([ new PlainTextNode('types') ]), new PlainTextNode(' of]') ]), new PlainTextNode(' pizza') ])) }) }) describe('Two left curly brackets followed by a single right curly bracket', () => { it('produces bracketed text starting from the second left curly bracket', () => { expect(Up.toAst(':{ I like {certain *types* of} pizza')).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode(':{ I like '), new CurlyBracketedNode([ new PlainTextNode('{certain '), new EmphasisNode([ new PlainTextNode('types') ]), new PlainTextNode(' of]') ]), new PlainTextNode(' pizza') ])) }) }) describe('A left curly bracket followed by two right curly brackets', () => { it('produces bracketed text ending with the first right curly bracket', () => { expect(Up.toAst('I like {certain *types* of} pizza :}')).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('I like '), new CurlyBracketedNode([ new PlainTextNode('{certain '), new EmphasisNode([ new PlainTextNode('types') ]), new PlainTextNode(' of}') ]), new PlainTextNode(' pizza :}') ])) }) })
Add 4 failing curly bracket tests
Add 4 failing curly bracket tests
TypeScript
mit
start/up,start/up
--- +++ @@ -0,0 +1,74 @@ +import { expect } from 'chai' +import Up from '../../index' +import { insideDocumentAndParagraph } from './Helpers' +import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' +import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode' +import { CurlyBracketedNode } from '../../SyntaxNodes/CurlyBracketedNode' + + +describe('Text surrounded by curly brackets', () => { + it('is put inside a curly bracketed node with the curly brackets preserved as plain text', () => { + expect(Up.toAst('I like {certain types of} pizza')).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('I like '), + new CurlyBracketedNode([ + new PlainTextNode('{certain types of}') + ]), + new PlainTextNode(' pizza') + ])) + }) +}) + + +describe('curly bracketed text', () => { + it('is evaluated for other conventions', () => { + expect(Up.toAst('I like {certain *types* of} pizza')).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('I like '), + new CurlyBracketedNode([ + new PlainTextNode('{certain '), + new EmphasisNode([ + new PlainTextNode('types') + ]), + new PlainTextNode(' of]') + ]), + new PlainTextNode(' pizza') + ])) + }) +}) + + +describe('Two left curly brackets followed by a single right curly bracket', () => { + it('produces bracketed text starting from the second left curly bracket', () => { + expect(Up.toAst(':{ I like {certain *types* of} pizza')).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode(':{ I like '), + new CurlyBracketedNode([ + new PlainTextNode('{certain '), + new EmphasisNode([ + new PlainTextNode('types') + ]), + new PlainTextNode(' of]') + ]), + new PlainTextNode(' pizza') + ])) + }) +}) + + +describe('A left curly bracket followed by two right curly brackets', () => { + it('produces bracketed text ending with the first right curly bracket', () => { + expect(Up.toAst('I like {certain *types* of} pizza :}')).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('I like '), + new CurlyBracketedNode([ + new PlainTextNode('{certain '), + new EmphasisNode([ + new PlainTextNode('types') + ]), + new PlainTextNode(' of}') + ]), + new PlainTextNode(' pizza :}') + ])) + }) +})
49d5a6d36e8c28175a3135121d0016d1e0cce70c
packages/apollo-cache-inmemory/src/__tests__/queryKeyMaker.ts
packages/apollo-cache-inmemory/src/__tests__/queryKeyMaker.ts
import { QueryKeyMaker } from '../queryKeyMaker'; import { CacheKeyNode } from '../optimism'; import gql from 'graphql-tag'; import { DocumentNode } from 'graphql'; describe('QueryKeyMaker', () => { const cacheKeyRoot = new CacheKeyNode(); const queryKeyMaker = new QueryKeyMaker(cacheKeyRoot); it('should work', () => { const query1: DocumentNode = gql` query { foo bar } `; const query2: DocumentNode = gql` query { # comment foo bar } `; const keyMaker1 = queryKeyMaker.forQuery(query1); const keyMaker2 = queryKeyMaker.forQuery(query2); expect(keyMaker1.lookupQuery(query2)).toBe(keyMaker2.lookupQuery(query1)); expect(keyMaker1.lookupQuery(query1)).toBe(keyMaker2.lookupQuery(query2)); let checkCount = 0; query1.definitions.forEach((def1, i) => { const def2 = query2.definitions[i]; expect(def1).not.toBe(def2); if ( def1.kind === 'OperationDefinition' && def2.kind === 'OperationDefinition' ) { expect(def1.selectionSet).not.toBe(def2.selectionSet); expect(keyMaker1.lookupSelectionSet(def1.selectionSet)).toBe( keyMaker2.lookupSelectionSet(def2.selectionSet), ); ++checkCount; } }); expect(checkCount).toBe(1); }); });
Add a basic test of the QueryKeyMaker.
Add a basic test of the QueryKeyMaker.
TypeScript
mit
apollostack/apollo-client,apollographql/apollo-client,apollostack/apollo-client,apollostack/apollo-client,apollographql/apollo-client
--- +++ @@ -0,0 +1,51 @@ +import { QueryKeyMaker } from '../queryKeyMaker'; +import { CacheKeyNode } from '../optimism'; +import gql from 'graphql-tag'; +import { DocumentNode } from 'graphql'; + +describe('QueryKeyMaker', () => { + const cacheKeyRoot = new CacheKeyNode(); + const queryKeyMaker = new QueryKeyMaker(cacheKeyRoot); + + it('should work', () => { + const query1: DocumentNode = gql` + query { + foo + bar + } + `; + + const query2: DocumentNode = gql` + query { + # comment + foo + bar + } + `; + + const keyMaker1 = queryKeyMaker.forQuery(query1); + const keyMaker2 = queryKeyMaker.forQuery(query2); + + expect(keyMaker1.lookupQuery(query2)).toBe(keyMaker2.lookupQuery(query1)); + + expect(keyMaker1.lookupQuery(query1)).toBe(keyMaker2.lookupQuery(query2)); + + let checkCount = 0; + query1.definitions.forEach((def1, i) => { + const def2 = query2.definitions[i]; + expect(def1).not.toBe(def2); + if ( + def1.kind === 'OperationDefinition' && + def2.kind === 'OperationDefinition' + ) { + expect(def1.selectionSet).not.toBe(def2.selectionSet); + expect(keyMaker1.lookupSelectionSet(def1.selectionSet)).toBe( + keyMaker2.lookupSelectionSet(def2.selectionSet), + ); + ++checkCount; + } + }); + + expect(checkCount).toBe(1); + }); +});
9ad742dc1398944bb3e470b51ecb4d0a38438152
app/test/helpers/menus/available-spellchecker-languages-helper.ts
app/test/helpers/menus/available-spellchecker-languages-helper.ts
/** * The list is based on Electron v17.0.1 * * Call to session.availableSpellCheckerLanguages * https://www.electronjs.org/docs/latest/api/session#sesavailablespellcheckerlanguages-readonly */ export function getAvailableSpellcheckerLanguages(): string[] { return [ 'af', 'bg', 'ca', 'cs', 'cy', 'da', 'de', 'de-DE', 'el', 'en-AU', 'en-CA', 'en-GB', 'en-GB-oxendict', 'en-US', 'es', 'es-419', 'es-AR', 'es-ES', 'es-MX', 'es-US', 'et', 'fa', 'fo', 'fr', 'fr-FR', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'it', 'it-IT', 'ko', 'lt', 'lv', 'nb', 'nl', 'pl', 'pt', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sh', 'sk', 'sl', 'sq', 'sr', 'sv', 'ta', 'tg', 'tr', 'uk', 'vi', ] }
Add available spellchecker languages as test helper
Add available spellchecker languages as test helper
TypeScript
mit
shiftkey/desktop,desktop/desktop,shiftkey/desktop,desktop/desktop,desktop/desktop,shiftkey/desktop,desktop/desktop,shiftkey/desktop
--- +++ @@ -0,0 +1,65 @@ +/** + * The list is based on Electron v17.0.1 + * + * Call to session.availableSpellCheckerLanguages + * https://www.electronjs.org/docs/latest/api/session#sesavailablespellcheckerlanguages-readonly + */ +export function getAvailableSpellcheckerLanguages(): string[] { + return [ + 'af', + 'bg', + 'ca', + 'cs', + 'cy', + 'da', + 'de', + 'de-DE', + 'el', + 'en-AU', + 'en-CA', + 'en-GB', + 'en-GB-oxendict', + 'en-US', + 'es', + 'es-419', + 'es-AR', + 'es-ES', + 'es-MX', + 'es-US', + 'et', + 'fa', + 'fo', + 'fr', + 'fr-FR', + 'he', + 'hi', + 'hr', + 'hu', + 'hy', + 'id', + 'it', + 'it-IT', + 'ko', + 'lt', + 'lv', + 'nb', + 'nl', + 'pl', + 'pt', + 'pt-BR', + 'pt-PT', + 'ro', + 'ru', + 'sh', + 'sk', + 'sl', + 'sq', + 'sr', + 'sv', + 'ta', + 'tg', + 'tr', + 'uk', + 'vi', + ] +}
4ac76f85e88326ccdc59963bb0d9f70533ea90eb
src/app/NavigatorShare.ts
src/app/NavigatorShare.ts
/** * Parameters for {@link Navigator#share} */ interface NavigatorShareParams { /** * The title to share */ title?: string; /** * The text to share */ text?: string; /** * The url to share */ url?: string; } interface Navigator { share(opts: NavigatorShareParams): Promise<any>; }
Add interface file for `navigator.share`
chore: Add interface file for `navigator.share`
TypeScript
mit
Chan4077/angular-rss-reader,Chan4077/angular-rss-reader,Chan4077/angular-rss-reader
--- +++ @@ -0,0 +1,20 @@ +/** + * Parameters for {@link Navigator#share} + */ +interface NavigatorShareParams { + /** + * The title to share + */ + title?: string; + /** + * The text to share + */ + text?: string; + /** + * The url to share + */ + url?: string; +} +interface Navigator { + share(opts: NavigatorShareParams): Promise<any>; +}
1e3887f0ba70ccd28923ce79cc6d3b4a78a877a5
typescript/graphs/algorithms/kahns-topological-sort.ts
typescript/graphs/algorithms/kahns-topological-sort.ts
import { Graph } from '../graph'; // This doesn't check if the graph is acyclic! function topologicalSort<T>(g: Graph<T>): T[] { g = g.copy(); const sorted: T[] = []; const nonIncoming = g.vertices.filter((v: T) => !g.edges.find(([_, dest]) => dest === v)); while (nonIncoming.length) { const v = nonIncoming.pop(); sorted.push(v); for (let i = 0; i < g.edges.length; i += 1) { if (!g.edges[i]) { continue; } const [src, dest] = g.edges[i]; if (src === v) { delete g.edges[i]; if (!g.edges.filter(e => !!e).find(([_, d]) => d === dest)) { nonIncoming.push(dest); } } } } return sorted; } // Demo: const graph = new Graph<string>(); graph.createVertex('A'); graph.createVertex('B'); graph.createVertex('C'); graph.createVertex('D'); graph.createVertex('E'); graph.createVertex('F'); graph.createVertex('G'); graph.createVertex('H'); graph.connectVertices('A', 'D', true); graph.connectVertices('D', 'F', true); graph.connectVertices('D', 'G', true); graph.connectVertices('D', 'H', true); graph.connectVertices('B', 'D', true); graph.connectVertices('B', 'E', true); graph.connectVertices('E', 'G', true); graph.connectVertices('C', 'E', true); graph.connectVertices('C', 'H', true); const sorted = topologicalSort<string>(graph); console.log(sorted);
Add TS Kahn's topological sorting
Add TS Kahn's topological sorting
TypeScript
mit
hAWKdv/DataStructures,hAWKdv/DataStructures
--- +++ @@ -0,0 +1,58 @@ +import { Graph } from '../graph'; + +// This doesn't check if the graph is acyclic! +function topologicalSort<T>(g: Graph<T>): T[] { + g = g.copy(); + const sorted: T[] = []; + const nonIncoming = g.vertices.filter((v: T) => !g.edges.find(([_, dest]) => dest === v)); + + while (nonIncoming.length) { + const v = nonIncoming.pop(); + sorted.push(v); + + for (let i = 0; i < g.edges.length; i += 1) { + if (!g.edges[i]) { + continue; + } + const [src, dest] = g.edges[i]; + if (src === v) { + delete g.edges[i]; + if (!g.edges.filter(e => !!e).find(([_, d]) => d === dest)) { + nonIncoming.push(dest); + } + } + } + } + + return sorted; +} + +// Demo: + +const graph = new Graph<string>(); + +graph.createVertex('A'); +graph.createVertex('B'); +graph.createVertex('C'); +graph.createVertex('D'); +graph.createVertex('E'); +graph.createVertex('F'); +graph.createVertex('G'); +graph.createVertex('H'); + +graph.connectVertices('A', 'D', true); + +graph.connectVertices('D', 'F', true); +graph.connectVertices('D', 'G', true); +graph.connectVertices('D', 'H', true); + +graph.connectVertices('B', 'D', true); +graph.connectVertices('B', 'E', true); + +graph.connectVertices('E', 'G', true); + +graph.connectVertices('C', 'E', true); +graph.connectVertices('C', 'H', true); + +const sorted = topologicalSort<string>(graph); +console.log(sorted);
64587eb951c26b146aa50f877ad14732ba8b46fe
config/app_test_default.ts
config/app_test_default.ts
// A real test configuration // @todo: consider reading from env vars export const server = { passportSecret: "something", loggerLevel: "debug", http: { active: true, port: 1080 }, recording_url_base: "http://test.site/recording" }; export const s3 = { publicKey: "minio", privateKey: "miniostorage", bucket: "cacophony", endpoint: "http://127.0.0.1:9001" }; export const fileProcessing = { port: 2008 }; // ======= Database settings ======= export const database = { username: "test", password: "test", database: "cacophonytest", host: "localhost", dialect: "postgres" }; export default { server, s3, fileProcessing, database, // This is needed because Sequelize looks for development by default // when using db:migrate development: database, }
Make sure config got added.
Make sure config got added.
TypeScript
agpl-3.0
TheCacophonyProject/Full_Noise
--- +++ @@ -0,0 +1,41 @@ +// A real test configuration +// @todo: consider reading from env vars + +export const server = { + passportSecret: "something", + loggerLevel: "debug", + http: { + active: true, + port: 1080 + }, + recording_url_base: "http://test.site/recording" +}; + +export const s3 = { + publicKey: "minio", + privateKey: "miniostorage", + bucket: "cacophony", + endpoint: "http://127.0.0.1:9001" +}; + +export const fileProcessing = { + port: 2008 +}; + +// ======= Database settings ======= +export const database = { + username: "test", + password: "test", + database: "cacophonytest", + host: "localhost", + dialect: "postgres" +}; +export default { + server, + s3, + fileProcessing, + database, + // This is needed because Sequelize looks for development by default +// when using db:migrate + development: database, +}
25e361311fbb0e2690942fc77c3511dba7234f74
src/__tests__/hooks.spec.ts
src/__tests__/hooks.spec.ts
import flatpickr from "index"; import { Options } from "types/options"; import { Instance } from "types/instance"; flatpickr.defaultConfig.animate = false; jest.useFakeTimers(); const createInstance = (config?: Options): Instance => { return flatpickr( document.createElement("input"), config as Options ) as Instance; }; describe("Events + Hooks", () => { it("should fire onOpen only once", () => { let timesFired = 0; const fp = createInstance({ onOpen: () => timesFired++, }); fp.open(); expect(timesFired).toEqual(1); }); });
Add unit test for onOpen
Add unit test for onOpen
TypeScript
mit
chmln/flatpickr,chmln/flatpickr
--- +++ @@ -0,0 +1,27 @@ +import flatpickr from "index"; +import { Options } from "types/options"; +import { Instance } from "types/instance"; + +flatpickr.defaultConfig.animate = false; + +jest.useFakeTimers(); + +const createInstance = (config?: Options): Instance => { + return flatpickr( + document.createElement("input"), + config as Options + ) as Instance; +}; + +describe("Events + Hooks", () => { + it("should fire onOpen only once", () => { + let timesFired = 0; + + const fp = createInstance({ + onOpen: () => timesFired++, + }); + + fp.open(); + expect(timesFired).toEqual(1); + }); +});
2ae6dd908592fe2abae4bdeb25306bc5b35e65e4
src/app/card/card.component.spec.ts
src/app/card/card.component.spec.ts
import { By } from '@angular/platform-browser'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DebugElement } from '@angular/core'; import { CardComponent } from './card.component'; describe('Card Component', () => { let component: CardComponent; let fixture: ComponentFixture<CardComponent>; let debugElement: DebugElement; let el: HTMLElement; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [CardComponent] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(CardComponent); component = fixture.componentInstance; debugElement = fixture.debugElement; el = debugElement.nativeElement; }); it('should display the given card value', () => { component.value = '5'; fixture.detectChanges(); const valueEl = debugElement.query(By.css('.value')); expect(valueEl.nativeElement.textContent).toBe('5'); }); it('should have a class name of `card-{{value}}`', () => { component.value = '5'; fixture.detectChanges(); const cardEl = debugElement.query(By.css('.card')); expect(cardEl.nativeElement.classList).toContain('card-5'); }); it('should fire an event when clicking on the front', () => { component.value = '5'; fixture.detectChanges(); const clickHandler = jasmine.createSpy('clickHandler'); const subscription = component.cardClick.subscribe(clickHandler); const frontEl = debugElement.query(By.css('.front')); frontEl.nativeElement.click(); expect(clickHandler).toHaveBeenCalledWith('5'); subscription.unsubscribe(); }); });
Add unit test for Card component
Add unit test for Card component
TypeScript
mit
joeattardi/scrum-deck,joeattardi/scrum-deck,joeattardi/scrum-deck
--- +++ @@ -0,0 +1,57 @@ +import { By } from '@angular/platform-browser'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { DebugElement } from '@angular/core'; + +import { CardComponent } from './card.component'; + +describe('Card Component', () => { + let component: CardComponent; + let fixture: ComponentFixture<CardComponent>; + let debugElement: DebugElement; + let el: HTMLElement; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [CardComponent] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CardComponent); + component = fixture.componentInstance; + + debugElement = fixture.debugElement; + el = debugElement.nativeElement; + }); + + it('should display the given card value', () => { + component.value = '5'; + fixture.detectChanges(); + + const valueEl = debugElement.query(By.css('.value')); + expect(valueEl.nativeElement.textContent).toBe('5'); + }); + + it('should have a class name of `card-{{value}}`', () => { + component.value = '5'; + fixture.detectChanges(); + + const cardEl = debugElement.query(By.css('.card')); + expect(cardEl.nativeElement.classList).toContain('card-5'); + }); + + it('should fire an event when clicking on the front', () => { + component.value = '5'; + fixture.detectChanges(); + + const clickHandler = jasmine.createSpy('clickHandler'); + const subscription = component.cardClick.subscribe(clickHandler); + + const frontEl = debugElement.query(By.css('.front')); + frontEl.nativeElement.click(); + + expect(clickHandler).toHaveBeenCalledWith('5'); + subscription.unsubscribe(); + }); +});
1359fdd379fc81fa1cac5e257514ea58a589e810
src/directives/summarization/summarization.directive.spec.ts
src/directives/summarization/summarization.directive.spec.ts
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SummarizationDirective } from './summarization.directive'; import { Component, ViewChild } from '@angular/core'; import { SummarizationModule } from './summarization.module'; import { LineChartComponent } from '../../components/line-chart/line-chart.component'; import { PreferenceService } from '../../services/preference/preference.service'; import { A11yPlaceholderModule } from '../a11y-placeholder/a11y-placeholder.module'; import { MatCardModule } from '@angular/material/card'; describe('AudificationDirective', () => { @Component({ selector: 'app-wrapper', template: ` <app-line-chart appSummarization></app-line-chart>`, }) class WrapperComponent { @ViewChild(LineChartComponent, { static: true }) hostComponent: LineChartComponent; @ViewChild(SummarizationDirective, { static: true }) directive: SummarizationDirective; } let preferenceService: PreferenceService; let fixture: ComponentFixture<WrapperComponent>; let wrapperComponent: WrapperComponent; let hostComponent: LineChartComponent; let directive: SummarizationDirective; const mockSummarizationPreference = { enabled: true, validityThreshold: 0.5, }; beforeEach(() => { preferenceService = new PreferenceService(); TestBed.configureTestingModule({ imports: [ SummarizationModule, A11yPlaceholderModule, MatCardModule, ], providers: [ { provide: PreferenceService, useValue: preferenceService } ], declarations: [ LineChartComponent, WrapperComponent, ], }); fixture = TestBed.createComponent(WrapperComponent); wrapperComponent = fixture.componentInstance; directive = wrapperComponent.directive; hostComponent = wrapperComponent.hostComponent; }); it('should instantiate.', () => { expect(directive).toBeInstanceOf(SummarizationDirective); }); it('should get the host correctly.', () => { expect(directive.host).toBe(hostComponent); }); it('should attach or detach audification as the preference changes.', () => { directive.ngOnInit(); const summarizationPreference = preferenceService.summarization$.value; spyOn(directive, 'attach'); preferenceService.summarization$.next({ ...summarizationPreference, enabled: true, }); expect(directive.attach).toHaveBeenCalled(); spyOn(directive, 'detach'); preferenceService.summarization$.next({ ...summarizationPreference, enabled: false, }); expect(directive.detach).toHaveBeenCalled(); }); it('should add a component to the a11y placeholder when attaching audification.', async () => { spyOn(hostComponent.a11yPlaceholder, 'addComponent'); await directive.attach(mockSummarizationPreference); expect(hostComponent.a11yPlaceholder.addComponent).toHaveBeenCalled(); }); it('should remove a component from the a11y placeholder when detaching audification.', async () => { await directive.attach(mockSummarizationPreference); spyOn(hostComponent.a11yPlaceholder, 'removeComponent'); directive.detach(); expect(hostComponent.a11yPlaceholder.removeComponent).toHaveBeenCalled(); }); });
Add tests for summarization directive
Add tests for summarization directive
TypeScript
apache-2.0
googleinterns/guide-doge,googleinterns/guide-doge,googleinterns/guide-doge
--- +++ @@ -0,0 +1,93 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { SummarizationDirective } from './summarization.directive'; +import { Component, ViewChild } from '@angular/core'; +import { SummarizationModule } from './summarization.module'; +import { LineChartComponent } from '../../components/line-chart/line-chart.component'; +import { PreferenceService } from '../../services/preference/preference.service'; +import { A11yPlaceholderModule } from '../a11y-placeholder/a11y-placeholder.module'; +import { MatCardModule } from '@angular/material/card'; + +describe('AudificationDirective', () => { + @Component({ + selector: 'app-wrapper', + template: ` + <app-line-chart appSummarization></app-line-chart>`, + }) + class WrapperComponent { + @ViewChild(LineChartComponent, { static: true }) hostComponent: LineChartComponent; + @ViewChild(SummarizationDirective, { static: true }) directive: SummarizationDirective; + } + + let preferenceService: PreferenceService; + let fixture: ComponentFixture<WrapperComponent>; + let wrapperComponent: WrapperComponent; + let hostComponent: LineChartComponent; + let directive: SummarizationDirective; + const mockSummarizationPreference = { + enabled: true, + validityThreshold: 0.5, + }; + + beforeEach(() => { + preferenceService = new PreferenceService(); + + TestBed.configureTestingModule({ + imports: [ + SummarizationModule, + A11yPlaceholderModule, + MatCardModule, + ], + providers: [ + { provide: PreferenceService, useValue: preferenceService } + ], + declarations: [ + LineChartComponent, + WrapperComponent, + ], + }); + fixture = TestBed.createComponent(WrapperComponent); + wrapperComponent = fixture.componentInstance; + directive = wrapperComponent.directive; + hostComponent = wrapperComponent.hostComponent; + }); + + it('should instantiate.', () => { + expect(directive).toBeInstanceOf(SummarizationDirective); + }); + + it('should get the host correctly.', () => { + expect(directive.host).toBe(hostComponent); + }); + + it('should attach or detach audification as the preference changes.', () => { + directive.ngOnInit(); + + const summarizationPreference = preferenceService.summarization$.value; + spyOn(directive, 'attach'); + preferenceService.summarization$.next({ + ...summarizationPreference, + enabled: true, + }); + expect(directive.attach).toHaveBeenCalled(); + + spyOn(directive, 'detach'); + preferenceService.summarization$.next({ + ...summarizationPreference, + enabled: false, + }); + expect(directive.detach).toHaveBeenCalled(); + }); + + it('should add a component to the a11y placeholder when attaching audification.', async () => { + spyOn(hostComponent.a11yPlaceholder, 'addComponent'); + await directive.attach(mockSummarizationPreference); + expect(hostComponent.a11yPlaceholder.addComponent).toHaveBeenCalled(); + }); + + it('should remove a component from the a11y placeholder when detaching audification.', async () => { + await directive.attach(mockSummarizationPreference); + spyOn(hostComponent.a11yPlaceholder, 'removeComponent'); + directive.detach(); + expect(hostComponent.a11yPlaceholder.removeComponent).toHaveBeenCalled(); + }); +});
492bc6ab6a75bfd5c4d03134c16dfbe9b8de25a2
ui/src/logs/components/SeverityConfig.tsx
ui/src/logs/components/SeverityConfig.tsx
import React, {SFC} from 'react' import uuid from 'uuid' import ColorDropdown, {Color} from 'src/logs/components/ColorDropdown' interface SeverityItem { severity: string default: Color override?: Color } interface Props { configs: SeverityItem[] onReset: () => void onChangeColor: (severity: string) => (override: Color) => void } const SeverityConfig: SFC<Props> = ({configs, onReset, onChangeColor}) => ( <> <label className="form-label">Customize Severity Colors</label> <div className="logs-options--color-list"> {configs.map(config => ( <div key={uuid.v4()} className="logs-options--color-row"> <div className="logs-options--color-column"> <div className="logs-options--label">{config.severity}</div> </div> <div className="logs-options--color-column"> <ColorDropdown selected={config.override || config.default} onChoose={onChangeColor(config.severity)} stretchToFit={true} /> </div> </div> ))} </div> <button className="btn btn-sm btn-default btn-block" onClick={onReset}> <span className="icon refresh" /> Reset to Defaults </button> </> ) export default SeverityConfig
Make severity configuration its own component
Make severity configuration its own component
TypeScript
mit
nooproblem/influxdb,influxdb/influxdb,influxdb/influxdb,li-ang/influxdb,nooproblem/influxdb,influxdata/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,influxdata/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,li-ang/influxdb,influxdb/influxdb,influxdb/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb
--- +++ @@ -0,0 +1,43 @@ +import React, {SFC} from 'react' +import uuid from 'uuid' +import ColorDropdown, {Color} from 'src/logs/components/ColorDropdown' + +interface SeverityItem { + severity: string + default: Color + override?: Color +} + +interface Props { + configs: SeverityItem[] + onReset: () => void + onChangeColor: (severity: string) => (override: Color) => void +} + +const SeverityConfig: SFC<Props> = ({configs, onReset, onChangeColor}) => ( + <> + <label className="form-label">Customize Severity Colors</label> + <div className="logs-options--color-list"> + {configs.map(config => ( + <div key={uuid.v4()} className="logs-options--color-row"> + <div className="logs-options--color-column"> + <div className="logs-options--label">{config.severity}</div> + </div> + <div className="logs-options--color-column"> + <ColorDropdown + selected={config.override || config.default} + onChoose={onChangeColor(config.severity)} + stretchToFit={true} + /> + </div> + </div> + ))} + </div> + <button className="btn btn-sm btn-default btn-block" onClick={onReset}> + <span className="icon refresh" /> + Reset to Defaults + </button> + </> +) + +export default SeverityConfig
a4e06b2b95a06ebd022b303c34172563ed75088d
src/client/app/components/admin/UsersManagementComponent.tsx
src/client/app/components/admin/UsersManagementComponent.tsx
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react'; import { Link } from 'react-router'; import { Button } from 'reactstrap'; export default function UsersManagementComponent() { const inlineButtonStyle: React.CSSProperties = { display: 'inline', paddingLeft: '5px' } return ( <div> <Link style={inlineButtonStyle} to='/users/new'><Button outline> Create a User </Button></Link> <Link style={inlineButtonStyle} to='/users' ><Button outline> View Users </Button></Link> </div> ) }
Add buttons to access different user management actions
Add buttons to access different user management actions
TypeScript
mpl-2.0
OpenEnergyDashboard/OED,OpenEnergyDashboard/OED,OpenEnergyDashboard/OED,OpenEnergyDashboard/OED
--- +++ @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import * as React from 'react'; +import { Link } from 'react-router'; +import { Button } from 'reactstrap'; + +export default function UsersManagementComponent() { + const inlineButtonStyle: React.CSSProperties = { + display: 'inline', + paddingLeft: '5px' + } + + return ( + <div> + <Link style={inlineButtonStyle} to='/users/new'><Button outline> Create a User </Button></Link> + <Link style={inlineButtonStyle} to='/users' ><Button outline> View Users </Button></Link> + </div> + ) +}
6282c9fb5e2097c86f44ee67da872423df1c1d5c
tests/cases/fourslash/completionsImport_noSemicolons.ts
tests/cases/fourslash/completionsImport_noSemicolons.ts
/// <reference path="fourslash.ts" /> // @Filename: /a.ts ////export function foo() {} // @Filename: /b.ts ////const x = 0 ////const y = 1 ////const z = fo/**/ verify.applyCodeActionFromCompletion("", { name: "foo", source: "/a", description: `Import 'foo' from module "./a"`, newFileContent: `import { foo } from "./a" const x = 0 const y = 1 const z = fo`, });
Add test for semicolon detection in auto-import
Add test for semicolon detection in auto-import
TypeScript
apache-2.0
alexeagle/TypeScript,kpreisser/TypeScript,microsoft/TypeScript,minestarks/TypeScript,kitsonk/TypeScript,weswigham/TypeScript,nojvek/TypeScript,microsoft/TypeScript,RyanCavanaugh/TypeScript,SaschaNaz/TypeScript,weswigham/TypeScript,microsoft/TypeScript,kpreisser/TypeScript,nojvek/TypeScript,alexeagle/TypeScript,SaschaNaz/TypeScript,Microsoft/TypeScript,minestarks/TypeScript,weswigham/TypeScript,kitsonk/TypeScript,nojvek/TypeScript,SaschaNaz/TypeScript,nojvek/TypeScript,RyanCavanaugh/TypeScript,SaschaNaz/TypeScript,Microsoft/TypeScript,minestarks/TypeScript,kpreisser/TypeScript,RyanCavanaugh/TypeScript,kitsonk/TypeScript,alexeagle/TypeScript,Microsoft/TypeScript
--- +++ @@ -0,0 +1,20 @@ +/// <reference path="fourslash.ts" /> + +// @Filename: /a.ts +////export function foo() {} + +// @Filename: /b.ts +////const x = 0 +////const y = 1 +////const z = fo/**/ + +verify.applyCodeActionFromCompletion("", { + name: "foo", + source: "/a", + description: `Import 'foo' from module "./a"`, + newFileContent: `import { foo } from "./a" + +const x = 0 +const y = 1 +const z = fo`, +});
33bec79debe90f47559065138fc387c1422e0958
desktop/core/src/desktop/js/webComponents/ExecutionAnalysis.ts
desktop/core/src/desktop/js/webComponents/ExecutionAnalysis.ts
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // 'License'); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an 'AS IS' BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import 'regenerator-runtime/runtime'; import ExecutionAnalysisPanel from 'apps/editor/components/executionAnalysis/ExecutionAnalysisPanel.vue'; import { isDefined, wrap } from 'vue/webComponentWrap'; const NAME = 'execution-analysis'; wrap(NAME, ExecutionAnalysisPanel); const executionAnalysisDefined = async (): Promise<void> => await isDefined(NAME); export default executionAnalysisDefined;
Add an execution-analysis web component for logs and errors
[frontend] Add an execution-analysis web component for logs and errors
TypeScript
apache-2.0
cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue
--- +++ @@ -0,0 +1,28 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// 'License'); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'regenerator-runtime/runtime'; + +import ExecutionAnalysisPanel from 'apps/editor/components/executionAnalysis/ExecutionAnalysisPanel.vue'; +import { isDefined, wrap } from 'vue/webComponentWrap'; + +const NAME = 'execution-analysis'; + +wrap(NAME, ExecutionAnalysisPanel); + +const executionAnalysisDefined = async (): Promise<void> => await isDefined(NAME); + +export default executionAnalysisDefined;
99be2f72f8b027098f7fdb5a245e57e6541fd2be
src/app/components/inline-assessment/share-rating.component.ts
src/app/components/inline-assessment/share-rating.component.ts
import {Component, Input} from '@angular/core' @Component({ selector: 'share-rating', template:` <div class="panel"> <div class="panel-body" style="padding-top: 0;"> <h3>¡Compártelo!</h3> <p>{{texto}}</p> <button class="btn" (click)="vote()"><img src="assets/img/fb.png" style="height: 30px;"></button> <button class="btn" (click)="vote()"><img src="assets/img/tw.jpeg" style="height: 30px;"></button> </div> </div> ` }) export class ShareRating { @Input() texto: string; }
Add rating panel to app
Add rating panel to app
TypeScript
agpl-3.0
llopv/jetpad-ic,llopv/jetpad-ic,llopv/jetpad-ic
--- +++ @@ -0,0 +1,19 @@ +import {Component, Input} from '@angular/core' + +@Component({ + selector: 'share-rating', + template:` + <div class="panel"> + <div class="panel-body" style="padding-top: 0;"> + <h3>¡Compártelo!</h3> + <p>{{texto}}</p> + <button class="btn" (click)="vote()"><img src="assets/img/fb.png" style="height: 30px;"></button> + <button class="btn" (click)="vote()"><img src="assets/img/tw.jpeg" style="height: 30px;"></button> + </div> + </div> + ` +}) + +export class ShareRating { + @Input() texto: string; +}
b46862560627ece8701871cce5b15e918ab02de0
migrations/20160713080742-change-message-text-limit.ts
migrations/20160713080742-change-message-text-limit.ts
import * as Sequelize from "sequelize" const migration = { up: async (queryInterface: Sequelize.QueryInterface) => { await queryInterface.changeColumn("messages", "text", { type: Sequelize.TEXT }) }, down: async (queryInterface: Sequelize.QueryInterface) => { await queryInterface.removeColumn("messages", "text") await queryInterface.addColumn("messages", "text", Sequelize.STRING) } } export = migration
Change column type VARCHAR(255) -> TEXT
Change column type VARCHAR(255) -> TEXT
TypeScript
mit
sketchglass/respass,sketchglass/respass,sketchglass/respass,sketchglass/respass
--- +++ @@ -0,0 +1,15 @@ +import * as Sequelize from "sequelize" + +const migration = { + up: async (queryInterface: Sequelize.QueryInterface) => { + await queryInterface.changeColumn("messages", "text", { + type: Sequelize.TEXT + }) + }, + down: async (queryInterface: Sequelize.QueryInterface) => { + await queryInterface.removeColumn("messages", "text") + await queryInterface.addColumn("messages", "text", Sequelize.STRING) + } +} + +export = migration
dc4d81a6bda11013ce1e1752a53a8cf00606adfd
knockout.rx/knockout.rx.d.ts
knockout.rx/knockout.rx.d.ts
// Type definitions for knockout.rx 1.0 // Project: https://github.com/Igorbek/knockout.rx // Definitions by: Igor Oleinikov <https://github.com/Igorbek> // Definitions: https://github.com/borisyankov/DefinitelyTyped /// <reference path="../knockout/knockout.d.ts"/> /// <reference path="../rx.js/rx.d.ts"/> interface KnockoutSubscribableFunctions<T> { toObservable(event?: string): Rx.Observable<T>; toObservable<TEvent>(event: string): Rx.Observable<TEvent>; } interface KnockoutObservableFunctions<T> { toObservableWithReplyLatest(): Rx.Observable<T>; toSubject(): Rx.ISubject<T>; } interface KnockoutComputedFunctions<T> { toObservableWithReplyLatest(): Rx.Observable<T>; } declare module Rx { interface Observable<T> { toKoSubscribable(): KnockoutSubscribable<T>; toKoObservable(initialValue?: T): KnockoutObservable<T>; } interface Subject<T> { toKoObservable(initialValue?: T): KnockoutObservable<T>; } }
// Type definitions for knockout.rx 1.0 // Project: https://github.com/Igorbek/knockout.rx // Definitions by: Igor Oleinikov <https://github.com/Igorbek> // Definitions: https://github.com/borisyankov/DefinitelyTyped /// <reference path="../knockout/knockout.d.ts"/> interface KnockoutSubscribableFunctions<T> { toObservable(event?: string): Rx.Observable<T>; toObservable<TEvent>(event: string): Rx.Observable<TEvent>; } interface KnockoutObservableFunctions<T> { toObservableWithReplyLatest(): Rx.Observable<T>; toSubject(): Rx.ISubject<T>; } interface KnockoutComputedFunctions<T> { toObservableWithReplyLatest(): Rx.Observable<T>; } declare module Rx { interface Observable<T> { toKoSubscribable(): KnockoutSubscribable<T>; toKoObservable(initialValue?: T): KnockoutObservable<T>; } interface Subject<T> { toKoObservable(initialValue?: T): KnockoutObservable<T>; } }
Remove useless reference to RxJS
Remove useless reference to RxJS This reference is not needed and is now causing problem because the definitelyTyped for RxJS is now part of the RxJS package directly. The Nuget package will needed to be changed also.
TypeScript
mit
davidpricedev/DefinitelyTyped,musically-ut/DefinitelyTyped,minodisk/DefinitelyTyped,daptiv/DefinitelyTyped,samdark/DefinitelyTyped,syuilo/DefinitelyTyped,evandrewry/DefinitelyTyped,mrk21/DefinitelyTyped,mattanja/DefinitelyTyped,duncanmak/DefinitelyTyped,wkrueger/DefinitelyTyped,dariajung/DefinitelyTyped,miguelmq/DefinitelyTyped,hiraash/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,martinduparc/DefinitelyTyped,gyohk/DefinitelyTyped,lbguilherme/DefinitelyTyped,ashwinr/DefinitelyTyped,JaminFarr/DefinitelyTyped,giggio/DefinitelyTyped,lseguin42/DefinitelyTyped,mcrawshaw/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,Seltzer/DefinitelyTyped,nabeix/DefinitelyTyped,duongphuhiep/DefinitelyTyped,onecentlin/DefinitelyTyped,zuohaocheng/DefinitelyTyped,philippstucki/DefinitelyTyped,jbrantly/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,reppners/DefinitelyTyped,glenndierckx/DefinitelyTyped,tscho/DefinitelyTyped,aldo-roman/DefinitelyTyped,biomassives/DefinitelyTyped,takfjt/DefinitelyTyped,Trapulo/DefinitelyTyped,xStrom/DefinitelyTyped,philippstucki/DefinitelyTyped,stephenjelfs/DefinitelyTyped,egeland/DefinitelyTyped,UzEE/DefinitelyTyped,borisyankov/DefinitelyTyped,scsouthw/DefinitelyTyped,zensh/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,johan-gorter/DefinitelyTyped,MugeSo/DefinitelyTyped,Mek7/DefinitelyTyped,dsebastien/DefinitelyTyped,dumbmatter/DefinitelyTyped,sandersky/DefinitelyTyped,Pro/DefinitelyTyped,mattblang/DefinitelyTyped,drinchev/DefinitelyTyped,bpowers/DefinitelyTyped,Garciat/DefinitelyTyped,sledorze/DefinitelyTyped,mshmelev/DefinitelyTyped,olemp/DefinitelyTyped,bencoveney/DefinitelyTyped,vagarenko/DefinitelyTyped,aciccarello/DefinitelyTyped,syuilo/DefinitelyTyped,tomtheisen/DefinitelyTyped,GodsBreath/DefinitelyTyped,tgfjt/DefinitelyTyped,ajtowf/DefinitelyTyped,tboyce/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,Dashlane/DefinitelyTyped,kuon/DefinitelyTyped,ecramer89/DefinitelyTyped,davidsidlinger/DefinitelyTyped,wbuchwalter/DefinitelyTyped,gcastre/DefinitelyTyped,nitintutlani/DefinitelyTyped,martinduparc/DefinitelyTyped,aciccarello/DefinitelyTyped,abmohan/DefinitelyTyped,brainded/DefinitelyTyped,nainslie/DefinitelyTyped,deeleman/DefinitelyTyped,chocolatechipui/DefinitelyTyped,stephenjelfs/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,jacqt/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,teves-castro/DefinitelyTyped,kabogo/DefinitelyTyped,rcchen/DefinitelyTyped,trystanclarke/DefinitelyTyped,shiwano/DefinitelyTyped,danfma/DefinitelyTyped,tgfjt/DefinitelyTyped,wcomartin/DefinitelyTyped,tan9/DefinitelyTyped,chadoliver/DefinitelyTyped,florentpoujol/DefinitelyTyped,Syati/DefinitelyTyped,mshmelev/DefinitelyTyped,Kuniwak/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,Zorgatone/DefinitelyTyped,damianog/DefinitelyTyped,rschmukler/DefinitelyTyped,RX14/DefinitelyTyped,kalloc/DefinitelyTyped,schmuli/DefinitelyTyped,ajtowf/DefinitelyTyped,magny/DefinitelyTyped,dwango-js/DefinitelyTyped,Dominator008/DefinitelyTyped,smrq/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,vote539/DefinitelyTyped,mcrawshaw/DefinitelyTyped,GregOnNet/DefinitelyTyped,timjk/DefinitelyTyped,basp/DefinitelyTyped,pocesar/DefinitelyTyped,yuit/DefinitelyTyped,psnider/DefinitelyTyped,alextkachman/DefinitelyTyped,HPFOD/DefinitelyTyped,mrozhin/DefinitelyTyped,OpenMaths/DefinitelyTyped,rerezz/DefinitelyTyped,ciriarte/DefinitelyTyped,mvarblow/DefinitelyTyped,bardt/DefinitelyTyped,arusakov/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,drinchev/DefinitelyTyped,abbasmhd/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,dflor003/DefinitelyTyped,dmoonfire/DefinitelyTyped,AgentME/DefinitelyTyped,gcastre/DefinitelyTyped,forumone/DefinitelyTyped,igorsechyn/DefinitelyTyped,jesseschalken/DefinitelyTyped,theyelllowdart/DefinitelyTyped,dsebastien/DefinitelyTyped,jimthedev/DefinitelyTyped,bobslaede/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,micurs/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,tigerxy/DefinitelyTyped,pkhayundi/DefinitelyTyped,QuatroCode/DefinitelyTyped,donnut/DefinitelyTyped,maxlang/DefinitelyTyped,stacktracejs/DefinitelyTyped,gandjustas/DefinitelyTyped,mhegazy/DefinitelyTyped,DeadAlready/DefinitelyTyped,rfranco/DefinitelyTyped,Pro/DefinitelyTyped,nycdotnet/DefinitelyTyped,lucyhe/DefinitelyTyped,abner/DefinitelyTyped,teddyward/DefinitelyTyped,fnipo/DefinitelyTyped,tomtarrot/DefinitelyTyped,tarruda/DefinitelyTyped,YousefED/DefinitelyTyped,pwelter34/DefinitelyTyped,musicist288/DefinitelyTyped,arusakov/DefinitelyTyped,munxar/DefinitelyTyped,felipe3dfx/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,hx0day/DefinitelyTyped,timramone/DefinitelyTyped,bdoss/DefinitelyTyped,eugenpodaru/DefinitelyTyped,paulmorphy/DefinitelyTyped,DeluxZ/DefinitelyTyped,dydek/DefinitelyTyped,innerverse/DefinitelyTyped,dragouf/DefinitelyTyped,Saneyan/DefinitelyTyped,leoromanovsky/DefinitelyTyped,samwgoldman/DefinitelyTyped,damianog/DefinitelyTyped,benliddicott/DefinitelyTyped,Fraegle/DefinitelyTyped,paxibay/DefinitelyTyped,billccn/DefinitelyTyped,hor-crux/DefinitelyTyped,Dominator008/DefinitelyTyped,nobuoka/DefinitelyTyped,xStrom/DefinitelyTyped,philippsimon/DefinitelyTyped,mareek/DefinitelyTyped,MugeSo/DefinitelyTyped,Syati/DefinitelyTyped,lekaha/DefinitelyTyped,stylelab-io/DefinitelyTyped,arusakov/DefinitelyTyped,alexdresko/DefinitelyTyped,reppners/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,nodeframe/DefinitelyTyped,Carreau/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,nakakura/DefinitelyTyped,philippsimon/DefinitelyTyped,EnableSoftware/DefinitelyTyped,alvarorahul/DefinitelyTyped,jsaelhof/DefinitelyTyped,elisee/DefinitelyTyped,aindlq/DefinitelyTyped,benishouga/DefinitelyTyped,minodisk/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,lightswitch05/DefinitelyTyped,amir-arad/DefinitelyTyped,newclear/DefinitelyTyped,MidnightDesign/DefinitelyTyped,tinganho/DefinitelyTyped,Bobjoy/DefinitelyTyped,gregoryagu/DefinitelyTyped,progre/DefinitelyTyped,greglo/DefinitelyTyped,zuzusik/DefinitelyTyped,hesselink/DefinitelyTyped,pocesar/DefinitelyTyped,fredgalvao/DefinitelyTyped,syntax42/DefinitelyTyped,emanuelhp/DefinitelyTyped,jraymakers/DefinitelyTyped,Karabur/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,Zzzen/DefinitelyTyped,shlomiassaf/DefinitelyTyped,chrootsu/DefinitelyTyped,nelsonmorais/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,Lorisu/DefinitelyTyped,danfma/DefinitelyTyped,aroder/DefinitelyTyped,alainsahli/DefinitelyTyped,hatz48/DefinitelyTyped,davidpricedev/DefinitelyTyped,rschmukler/DefinitelyTyped,smrq/DefinitelyTyped,isman-usoh/DefinitelyTyped,teves-castro/DefinitelyTyped,trystanclarke/DefinitelyTyped,nakakura/DefinitelyTyped,mszczepaniak/DefinitelyTyped,rushi216/DefinitelyTyped,vote539/DefinitelyTyped,paulmorphy/DefinitelyTyped,lukehoban/DefinitelyTyped,KonaTeam/DefinitelyTyped,DustinWehr/DefinitelyTyped,markogresak/DefinitelyTyped,robertbaker/DefinitelyTyped,TheBay0r/DefinitelyTyped,bennett000/DefinitelyTyped,egeland/DefinitelyTyped,subash-a/DefinitelyTyped,vincentw56/DefinitelyTyped,corps/DefinitelyTyped,hellopao/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,sclausen/DefinitelyTyped,wilfrem/DefinitelyTyped,TildaLabs/DefinitelyTyped,xswordsx/DefinitelyTyped,YousefED/DefinitelyTyped,blink1073/DefinitelyTyped,arcticwaters/DefinitelyTyped,tan9/DefinitelyTyped,georgemarshall/DefinitelyTyped,Ridermansb/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,digitalpixies/DefinitelyTyped,erosb/DefinitelyTyped,AgentME/DefinitelyTyped,mareek/DefinitelyTyped,esperco/DefinitelyTyped,uestcNaldo/DefinitelyTyped,benishouga/DefinitelyTyped,drillbits/DefinitelyTyped,cherrydev/DefinitelyTyped,furny/DefinitelyTyped,fredgalvao/DefinitelyTyped,QuatroCode/DefinitelyTyped,LordJZ/DefinitelyTyped,acepoblete/DefinitelyTyped,manekovskiy/DefinitelyTyped,gdi2290/DefinitelyTyped,brettle/DefinitelyTyped,ErykB2000/DefinitelyTyped,rolandzwaga/DefinitelyTyped,axelcostaspena/DefinitelyTyped,use-strict/DefinitelyTyped,benishouga/DefinitelyTyped,dmoonfire/DefinitelyTyped,elisee/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,Ptival/DefinitelyTyped,isman-usoh/DefinitelyTyped,MarlonFan/DefinitelyTyped,nobuoka/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,arma-gast/DefinitelyTyped,alvarorahul/DefinitelyTyped,Shiak1/DefinitelyTyped,glenndierckx/DefinitelyTyped,superduper/DefinitelyTyped,Nemo157/DefinitelyTyped,zuzusik/DefinitelyTyped,magny/DefinitelyTyped,nainslie/DefinitelyTyped,donnut/DefinitelyTyped,Seikho/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,mendix/DefinitelyTyped,borisyankov/DefinitelyTyped,spearhead-ea/DefinitelyTyped,moonpyk/DefinitelyTyped,zuzusik/DefinitelyTyped,hypno2000/typings,OpenMaths/DefinitelyTyped,tdmckinn/DefinitelyTyped,hellopao/DefinitelyTyped,nycdotnet/DefinitelyTyped,ducin/DefinitelyTyped,florentpoujol/DefinitelyTyped,whoeverest/DefinitelyTyped,sixinli/DefinitelyTyped,optical/DefinitelyTyped,nojaf/DefinitelyTyped,martinduparc/DefinitelyTyped,use-strict/DefinitelyTyped,emanuelhp/DefinitelyTyped,hellopao/DefinitelyTyped,igorraush/DefinitelyTyped,bobslaede/DefinitelyTyped,hafenr/DefinitelyTyped,Zenorbi/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,bdoss/DefinitelyTyped,evansolomon/DefinitelyTyped,jiaz/DefinitelyTyped,PascalSenn/DefinitelyTyped,lbesson/DefinitelyTyped,progre/DefinitelyTyped,AgentME/DefinitelyTyped,masonkmeyer/DefinitelyTyped,Riron/DefinitelyTyped,awerlang/DefinitelyTyped,jaysoo/DefinitelyTyped,olivierlemasle/DefinitelyTyped,bluong/DefinitelyTyped,modifyink/DefinitelyTyped,greglockwood/DefinitelyTyped,behzad88/DefinitelyTyped,miguelmq/DefinitelyTyped,Gmulti/DefinitelyTyped,algorithme/DefinitelyTyped,fearthecowboy/DefinitelyTyped,herrmanno/DefinitelyTyped,bjfletcher/DefinitelyTyped,mattblang/DefinitelyTyped,behzad888/DefinitelyTyped,NCARalph/DefinitelyTyped,nmalaguti/DefinitelyTyped,hatz48/DefinitelyTyped,wilfrem/DefinitelyTyped,ml-workshare/DefinitelyTyped,arma-gast/DefinitelyTyped,Pipe-shen/DefinitelyTyped,jpevarnek/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,onecentlin/DefinitelyTyped,ashwinr/DefinitelyTyped,takenet/DefinitelyTyped,dreampulse/DefinitelyTyped,quantumman/DefinitelyTyped,Litee/DefinitelyTyped,adamcarr/DefinitelyTyped,sledorze/DefinitelyTyped,jimthedev/DefinitelyTyped,raijinsetsu/DefinitelyTyped,pocke/DefinitelyTyped,icereed/DefinitelyTyped,mcliment/DefinitelyTyped,Litee/DefinitelyTyped,Chris380/DefinitelyTyped,stanislavHamara/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,georgemarshall/DefinitelyTyped,psnider/DefinitelyTyped,schmuli/DefinitelyTyped,maglar0/DefinitelyTyped,mjjames/DefinitelyTyped,scriby/DefinitelyTyped,newclear/DefinitelyTyped,zalamtech/DefinitelyTyped,tjoskar/DefinitelyTyped,nseckinoral/DefinitelyTyped,rockclimber90/DefinitelyTyped,rcchen/DefinitelyTyped,bilou84/DefinitelyTyped,HereSinceres/DefinitelyTyped,dydek/DefinitelyTyped,RX14/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,richardTowers/DefinitelyTyped,arcticwaters/DefinitelyTyped,opichals/DefinitelyTyped,abbasmhd/DefinitelyTyped,robert-voica/DefinitelyTyped,laball/DefinitelyTyped,robl499/DefinitelyTyped,chrismbarr/DefinitelyTyped,jeffbcross/DefinitelyTyped,mhegazy/DefinitelyTyped,angelobelchior8/DefinitelyTyped,the41/DefinitelyTyped,Zzzen/DefinitelyTyped,nitintutlani/DefinitelyTyped,muenchdo/DefinitelyTyped,grahammendick/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,gandjustas/DefinitelyTyped,jraymakers/DefinitelyTyped,scatcher/DefinitelyTyped,jtlan/DefinitelyTyped,georgemarshall/DefinitelyTyped,mjjames/DefinitelyTyped,shlomiassaf/DefinitelyTyped,mwain/DefinitelyTyped,rolandzwaga/DefinitelyTyped,PopSugar/DefinitelyTyped,raijinsetsu/DefinitelyTyped,applesaucers/lodash-invokeMap,unknownloner/DefinitelyTyped,one-pieces/DefinitelyTyped,jasonswearingen/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,gyohk/DefinitelyTyped,frogcjn/DefinitelyTyped,adammartin1981/DefinitelyTyped,behzad888/DefinitelyTyped,applesaucers/lodash-invokeMap,jsaelhof/DefinitelyTyped,subjectix/DefinitelyTyped,Minishlink/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,modifyink/DefinitelyTyped,darkl/DefinitelyTyped,chbrown/DefinitelyTyped,chrismbarr/DefinitelyTyped,Deathspike/DefinitelyTyped,IAPark/DefinitelyTyped,zhiyiting/DefinitelyTyped,olemp/DefinitelyTyped,Ptival/DefinitelyTyped,ayanoin/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,amanmahajan7/DefinitelyTyped,esperco/DefinitelyTyped,frogcjn/DefinitelyTyped,M-Zuber/DefinitelyTyped,jeremyhayes/DefinitelyTyped,subash-a/DefinitelyTyped,abner/DefinitelyTyped,vpineda1996/DefinitelyTyped,shiwano/DefinitelyTyped,omidkrad/DefinitelyTyped,Jwsonic/DefinitelyTyped,gedaiu/DefinitelyTyped,cvrajeesh/DefinitelyTyped,alextkachman/DefinitelyTyped,georgemarshall/DefinitelyTyped,bkristensen/DefinitelyTyped,gildorwang/DefinitelyTyped,yuit/DefinitelyTyped,mweststrate/DefinitelyTyped,jasonswearingen/DefinitelyTyped,michalczukm/DefinitelyTyped,aciccarello/DefinitelyTyped,CSharpFan/DefinitelyTyped,Penryn/DefinitelyTyped,dpsthree/DefinitelyTyped,bennett000/DefinitelyTyped,greglo/DefinitelyTyped,jimthedev/DefinitelyTyped,pwelter34/DefinitelyTyped,pafflique/DefinitelyTyped,chrilith/DefinitelyTyped,shovon/DefinitelyTyped,pocesar/DefinitelyTyped,almstrand/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,vagarenko/DefinitelyTyped,stacktracejs/DefinitelyTyped,ryan10132/DefinitelyTyped,vasek17/DefinitelyTyped,RedSeal-co/DefinitelyTyped,AgentME/DefinitelyTyped,vsavkin/DefinitelyTyped,musakarakas/DefinitelyTyped,eekboom/DefinitelyTyped,UzEE/DefinitelyTyped,flyfishMT/DefinitelyTyped,chrootsu/DefinitelyTyped,goaty92/DefinitelyTyped,johan-gorter/DefinitelyTyped,haskellcamargo/DefinitelyTyped,gorcz/DefinitelyTyped,Almouro/DefinitelyTyped,OfficeDev/DefinitelyTyped,DenEwout/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,laco0416/DefinitelyTyped,sclausen/DefinitelyTyped,Penryn/DefinitelyTyped,flyfishMT/DefinitelyTyped,brentonhouse/DefinitelyTyped,arueckle/DefinitelyTyped,Zorgatone/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,kmeurer/DefinitelyTyped,amanmahajan7/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,xica/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,WritingPanda/DefinitelyTyped,nfriend/DefinitelyTyped,shahata/DefinitelyTyped,psnider/DefinitelyTyped,HPFOD/DefinitelyTyped,schmuli/DefinitelyTyped,takenet/DefinitelyTyped,bruennijs/DefinitelyTyped,Karabur/DefinitelyTyped,optical/DefinitelyTyped,scriby/DefinitelyTyped,aqua89/DefinitelyTyped,nmalaguti/DefinitelyTyped,kanreisa/DefinitelyTyped,alexdresko/DefinitelyTyped,mattanja/DefinitelyTyped,EnableSoftware/DefinitelyTyped,Dashlane/DefinitelyTyped
--- +++ @@ -4,7 +4,6 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// <reference path="../knockout/knockout.d.ts"/> -/// <reference path="../rx.js/rx.d.ts"/> interface KnockoutSubscribableFunctions<T> { toObservable(event?: string): Rx.Observable<T>;
4190cf945c2a031574d9229a15ff196a0a1b51ad
src/Test/Ast/InputInstructionNode.ts
src/Test/Ast/InputInstructionNode.ts
/* import { expect } from 'chai' import Up from '../../index' import { insideDocumentAndParagraph } from './Helpers' import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' import { InputInstructionNode } from '../../SyntaxNodes/InputInstructionNode' describe('Text surrounded by curly brackets', () => { it('is put into an input instruciton node', () => { expect(Up.toAst('Press {esc} to quit.')).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Press '), new InputInstructionNode('esc'), new PlainTextNode('to quit'), ])) }) }) describe('An input instruction', () => { it('is not evaluated for other conventions', () => { expect(Up.toAst("Select the {Start Game(s)} menu item.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Hello, '), new InputInstructionNode('Start Games(s)'), new PlainTextNode('!') ])) }) it('has any outer whitespace trimmed away', () => { expect(Up.toAst("Select the { \t Start Game(s) \t } menu item.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Select the '), new InputInstructionNode('Start Games(s)'), new PlainTextNode('menu item.') ])) }) context('can contain escaped closing curly brackets', () => { it('touching the delimiters', () => { expect(Up.toAst("Press {\\}} to view paths.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Press '), new InputInstructionNode('}'), new PlainTextNode(' to view paths') ])) }) it('not touching the delimiters', () => { expect(Up.toAst("Press { \\} } to view paths.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Press '), new InputInstructionNode('}'), new PlainTextNode(' to view paths') ])) }) }) context('can contain unescaped opening curly brackets', () => { it('touching the delimiters', () => { expect(Up.toAst("Press {{} to view paths.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Press '), new InputInstructionNode('}'), new PlainTextNode(' to view paths') ])) }) it('not touching the delimiters', () => { expect(Up.toAst("Press { { } to view paths.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Press '), new InputInstructionNode('}'), new PlainTextNode(' to view paths') ])) }) }) it('can be directly followed by another input instruction', () => { expect(Up.toAst("Press {ctrl}{q} to quit.")).to.be.eql( insideDocumentAndParagraph([ new PlainTextNode('Hello, '), new InputInstructionNode('Start Games(s)'), new PlainTextNode('!') ])) }) }) */
Add commented-out input instruction test file
Add commented-out input instruction test file
TypeScript
mit
start/up,start/up
--- +++ @@ -0,0 +1,90 @@ +/* + +import { expect } from 'chai' +import Up from '../../index' +import { insideDocumentAndParagraph } from './Helpers' +import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' +import { InputInstructionNode } from '../../SyntaxNodes/InputInstructionNode' + + +describe('Text surrounded by curly brackets', () => { + it('is put into an input instruciton node', () => { + expect(Up.toAst('Press {esc} to quit.')).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Press '), + new InputInstructionNode('esc'), + new PlainTextNode('to quit'), + ])) + }) +}) + + +describe('An input instruction', () => { + it('is not evaluated for other conventions', () => { + expect(Up.toAst("Select the {Start Game(s)} menu item.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Hello, '), + new InputInstructionNode('Start Games(s)'), + new PlainTextNode('!') + ])) + }) + + it('has any outer whitespace trimmed away', () => { + expect(Up.toAst("Select the { \t Start Game(s) \t } menu item.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Select the '), + new InputInstructionNode('Start Games(s)'), + new PlainTextNode('menu item.') + ])) + }) + + context('can contain escaped closing curly brackets', () => { + it('touching the delimiters', () => { + expect(Up.toAst("Press {\\}} to view paths.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Press '), + new InputInstructionNode('}'), + new PlainTextNode(' to view paths') + ])) + }) + + it('not touching the delimiters', () => { + expect(Up.toAst("Press { \\} } to view paths.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Press '), + new InputInstructionNode('}'), + new PlainTextNode(' to view paths') + ])) + }) + }) + + context('can contain unescaped opening curly brackets', () => { + it('touching the delimiters', () => { + expect(Up.toAst("Press {{} to view paths.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Press '), + new InputInstructionNode('}'), + new PlainTextNode(' to view paths') + ])) + }) + + it('not touching the delimiters', () => { + expect(Up.toAst("Press { { } to view paths.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Press '), + new InputInstructionNode('}'), + new PlainTextNode(' to view paths') + ])) + }) + }) + + it('can be directly followed by another input instruction', () => { + expect(Up.toAst("Press {ctrl}{q} to quit.")).to.be.eql( + insideDocumentAndParagraph([ + new PlainTextNode('Hello, '), + new InputInstructionNode('Start Games(s)'), + new PlainTextNode('!') + ])) + }) +}) +*/
12c8bf1bff18e4a3f2163af1aa74823a02932350
types/vscode/vscode-tests.ts
types/vscode/vscode-tests.ts
import * as vscode from 'vscode'; vscode.commands.registerCommand('extension.helloWorld', () => { vscode.window.showInformationMessage('Hello World!'); }); vscode.languages.registerCompletionItemProvider('markdown', { provideCompletionItems() { return []; } }); const nodeDependenciesProvider: vscode.TreeDataProvider<string> = { getChildren() { return []; }, getTreeItem(el: string) { return { id: el }; } }; vscode.window.registerTreeDataProvider('nodeDependencies', nodeDependenciesProvider);
import * as vscode from 'vscode'; vscode.commands.registerCommand('extension.helloWorld', () => { vscode.window.showInformationMessage('Hello World!'); }); vscode.languages.registerCompletionItemProvider('markdown', { provideCompletionItems() { return []; } });
Drop tree API since it changed a lot
Drop tree API since it changed a lot
TypeScript
mit
georgemarshall/DefinitelyTyped,markogresak/DefinitelyTyped,dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,borisyankov/DefinitelyTyped,mcliment/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped
--- +++ @@ -9,16 +9,3 @@ return []; } }); - -const nodeDependenciesProvider: vscode.TreeDataProvider<string> = { - getChildren() { - return []; - }, - getTreeItem(el: string) { - return { - id: el - }; - } -}; - -vscode.window.registerTreeDataProvider('nodeDependencies', nodeDependenciesProvider);
1d97e56c76d3554f215f768be56558c2b79a60b4
lib/Element.ts
lib/Element.ts
export function repaint(element: HTMLElement): void { // tslint:disable-next-line element.offsetHeight; } export function srcAttribute(wrapper: HTMLElement, image: HTMLImageElement): string { let attribute: string | null = wrapper.getAttribute('data-src'); if (attribute !== null) { return attribute; } return image.src as string; } export function hasClass(element: HTMLElement, name: string): boolean { return element.className.indexOf(name) !== -1; } export function addClass(element: HTMLElement, name: string): void { element.className += ` ${name}`; } export function removeClass(element: HTMLElement, name: string): void { let classes: string[] = element.className.split(' '); classes.splice(classes.indexOf(name), 1); element.className = classes.join(' '); }
export function repaint(element: HTMLElement): void { // tslint:disable-next-line element.offsetHeight; } export function srcAttribute(wrapper: HTMLElement, image: HTMLImageElement): string { let attribute: string | null = wrapper.getAttribute('data-src'); if (attribute !== null) { return attribute; } return image.src as string; } export function hasClass(element: HTMLElement, name: string): boolean { return element.className.indexOf(name) !== -1; } export function addClass(element: HTMLElement, name: string): void { element.className += ` ${name}`; } export function removeClass(element: HTMLElement, name: string): void { let existing: string = element.className; if (existing.indexOf(' ') !== -1) { let classes: string[] = existing.split(' '); classes.splice(classes.indexOf(name), 1); element.className = classes.join(' '); } else if (existing === name) { element.className = ''; } }
Fix issue with removing classes
Fix issue with removing classes
TypeScript
unknown
MikeBull94/zoom.ts,michaelbull/zoom.ts,MikeBull94/zoom.ts,michaelbull/zoom.ts,MikeBull94/zoom.ts
--- +++ @@ -22,7 +22,13 @@ } export function removeClass(element: HTMLElement, name: string): void { - let classes: string[] = element.className.split(' '); - classes.splice(classes.indexOf(name), 1); - element.className = classes.join(' '); + let existing: string = element.className; + + if (existing.indexOf(' ') !== -1) { + let classes: string[] = existing.split(' '); + classes.splice(classes.indexOf(name), 1); + element.className = classes.join(' '); + } else if (existing === name) { + element.className = ''; + } }
0e47602adbb783cb83926476d098c1db8a26a196
test/user-list-item-spec.ts
test/user-list-item-spec.ts
import { expect } from './support'; import { createMockStore } from './lib/mock-store'; import { Store } from '../src/lib/store'; import { User, Profile } from '../src/lib/models/api-shapes'; import { UserViewModel } from '../src/user-list-item'; const storeData: { [key: string]: User } = { jamesFranco: { id: 'jamesFranco', name: 'franco', real_name: 'James Franco', profile: { image_72: 'http://screencomment.com/site/wp-content/uploads/2010/05/james_franco.jpg' } as Profile } as User }; describe('the UserViewModel', () => { let store: Store, userKey: string, fixture: UserViewModel; beforeEach(() => { store = createMockStore(storeData); userKey = Object.keys(storeData)[0]; fixture = new UserViewModel(store, userKey, null); }); it('should use a default profile image until it retrieves the user', async () => { expect(fixture.profileImage.match(/default-avatar/)).to.be.ok; await fixture.changed.take(1).toPromise(); expect(fixture.profileImage.match(/james_franco/)).to.be.ok; }); });
Write a test for the UserViewModel.
Write a test for the UserViewModel.
TypeScript
bsd-3-clause
paulcbetts/trickline,paulcbetts/trickline,paulcbetts/trickline,paulcbetts/trickline
--- +++ @@ -0,0 +1,32 @@ +import { expect } from './support'; +import { createMockStore } from './lib/mock-store'; +import { Store } from '../src/lib/store'; +import { User, Profile } from '../src/lib/models/api-shapes'; +import { UserViewModel } from '../src/user-list-item'; + +const storeData: { [key: string]: User } = { + jamesFranco: { + id: 'jamesFranco', + name: 'franco', + real_name: 'James Franco', + profile: { + image_72: 'http://screencomment.com/site/wp-content/uploads/2010/05/james_franco.jpg' + } as Profile + } as User +}; + +describe('the UserViewModel', () => { + let store: Store, userKey: string, fixture: UserViewModel; + + beforeEach(() => { + store = createMockStore(storeData); + userKey = Object.keys(storeData)[0]; + fixture = new UserViewModel(store, userKey, null); + }); + + it('should use a default profile image until it retrieves the user', async () => { + expect(fixture.profileImage.match(/default-avatar/)).to.be.ok; + await fixture.changed.take(1).toPromise(); + expect(fixture.profileImage.match(/james_franco/)).to.be.ok; + }); +});
7c09785614350ebc490e35608e9b6627ed106777
src/app/core/services/control-api/control-api.service.ts
src/app/core/services/control-api/control-api.service.ts
import { Injectable } from '@angular/core'; import { HttpHeaders, HttpClient } from '@angular/common/http'; import { Constants } from 'src/app/common/constants'; @Injectable({ providedIn: 'root' }) // NOTE: Mongoose's CONTROL API is used for controlling execution of the Mongoose app itself. // Example: running with custom configurations, running with custom scenarios, etc. export class ControlApiService { constructor(private http: HttpClient) { } runMongoose(jsonConfiguration: string = "", javaScriptScenario: string = ""): any { // NOTE: Using JSON.stirngly(...) to pass Scenario as a HTTP parameter. It could contains multiple quotes, JSON.stringfy(...) handles it well. javaScriptScenario = JSON.stringify(javaScriptScenario); let formData = new FormData(); formData.append('defaults', jsonConfiguration); this.http.post('http://' + Constants.Configuration.MONGOOSE_HOST_IP + '/run?defaults=' + formData + "&scenario=" + javaScriptScenario, this.getHttpHeaderForJsonFile()).subscribe( error => alert("Unable to run Mongoose with current configuration. Reason: " + error) ); } private getHttpHeaderForJsonFile(): HttpHeaders { const httpHeadersForMongooseRun = new HttpHeaders(); httpHeadersForMongooseRun.append('Accept', 'application/json'); const eTag = this.getEtagForRun(); httpHeadersForMongooseRun.append('If-Match', eTag); return httpHeadersForMongooseRun; } // NOTE: ETAG is HEX representation of configuration start time in milliseconds private getEtagForRun(): string { const currentDateTime = Date.now(); const hexNumericSystemBase = 16; return currentDateTime.toString(hexNumericSystemBase); } }
Fix issue with adding IP addresses to the UI.
Fix issue with adding IP addresses to the UI.
TypeScript
mit
emc-mongoose/console,emc-mongoose/console,emc-mongoose/console
--- +++ @@ -0,0 +1,45 @@ +import { Injectable } from '@angular/core'; +import { HttpHeaders, HttpClient } from '@angular/common/http'; +import { Constants } from 'src/app/common/constants'; + +@Injectable({ + providedIn: 'root' +}) + +// NOTE: Mongoose's CONTROL API is used for controlling execution of the Mongoose app itself. +// Example: running with custom configurations, running with custom scenarios, etc. + +export class ControlApiService { + + constructor(private http: HttpClient) { } + + runMongoose(jsonConfiguration: string = "", javaScriptScenario: string = ""): any { + + // NOTE: Using JSON.stirngly(...) to pass Scenario as a HTTP parameter. It could contains multiple quotes, JSON.stringfy(...) handles it well. + javaScriptScenario = JSON.stringify(javaScriptScenario); + + let formData = new FormData(); + formData.append('defaults', jsonConfiguration); + this.http.post('http://' + Constants.Configuration.MONGOOSE_HOST_IP + '/run?defaults=' + formData + "&scenario=" + javaScriptScenario, this.getHttpHeaderForJsonFile()).subscribe( + error => alert("Unable to run Mongoose with current configuration. Reason: " + error) + ); + } + + + private getHttpHeaderForJsonFile(): HttpHeaders { + const httpHeadersForMongooseRun = new HttpHeaders(); + httpHeadersForMongooseRun.append('Accept', 'application/json'); + const eTag = this.getEtagForRun(); + httpHeadersForMongooseRun.append('If-Match', eTag); + return httpHeadersForMongooseRun; + } + + + // NOTE: ETAG is HEX representation of configuration start time in milliseconds + private getEtagForRun(): string { + const currentDateTime = Date.now(); + const hexNumericSystemBase = 16; + return currentDateTime.toString(hexNumericSystemBase); + } + +}
173294924093d969147df85c5215fa7fcfb41506
src/mocks/providers/mock-camera.ts
src/mocks/providers/mock-camera.ts
export class MockCamera { DestinationType = { 'FILE_URI': 'FILE_URI' }; EncodingType = { 'JPEG': 'JPEG' }; MediaType = { 'PICTURE': 'PICTURE' }; getPicture(options) { return new Promise((resolve, reject) => { let categories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nightlife', 'fashion', 'people', 'nature', 'sports', 'technics', 'transport']; let randomImageNumber = Math.floor(Math.random() * 10) + 1; let randomCategoryNumber = Math.floor(Math.random() * (categories.length - 1)); let category = categories[randomCategoryNumber]; resolve('http://lorempixel.com/800/1024/' + category + '/' + randomImageNumber); }); } }
Create mock camera that can be used for browser testing.
Create mock camera that can be used for browser testing.
TypeScript
mit
IMSmobile/app,IMSmobile/app,IMSmobile/app,IMSmobile/app
--- +++ @@ -0,0 +1,15 @@ +export class MockCamera { + DestinationType = { 'FILE_URI': 'FILE_URI' }; + EncodingType = { 'JPEG': 'JPEG' }; + MediaType = { 'PICTURE': 'PICTURE' }; + + getPicture(options) { + return new Promise((resolve, reject) => { + let categories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nightlife', 'fashion', 'people', 'nature', 'sports', 'technics', 'transport']; + let randomImageNumber = Math.floor(Math.random() * 10) + 1; + let randomCategoryNumber = Math.floor(Math.random() * (categories.length - 1)); + let category = categories[randomCategoryNumber]; + resolve('http://lorempixel.com/800/1024/' + category + '/' + randomImageNumber); + }); + } +}
60a0d17758f7d355e4b096081c670f4b7c88216d
src/helpers/propTypes.spec.ts
src/helpers/propTypes.spec.ts
import * as propTypes from './propTypes'; describe('propTypes', () => { describe('wildcard', () => { it('does not return an error, no matter what you throw at it', () => { const tests = [null, undefined, 1, 'foo', { foo: 'foo' }, ['foo']]; expect.assertions(tests.length); // tslint:disable-next-line:no-any tests.forEach((test: any) => expect(propTypes.wildcard(test)).not.toBeInstanceOf(Error), ); }); }); });
Add unit tests for propTypes helper
Add unit tests for propTypes helper
TypeScript
mit
springload/react-accessible-accordion,springload/react-accessible-accordion,springload/react-accessible-accordion
--- +++ @@ -0,0 +1,15 @@ +import * as propTypes from './propTypes'; + +describe('propTypes', () => { + describe('wildcard', () => { + it('does not return an error, no matter what you throw at it', () => { + const tests = [null, undefined, 1, 'foo', { foo: 'foo' }, ['foo']]; + expect.assertions(tests.length); + + // tslint:disable-next-line:no-any + tests.forEach((test: any) => + expect(propTypes.wildcard(test)).not.toBeInstanceOf(Error), + ); + }); + }); +});
1b9f4dead40cfe087022c82ebc6106f94381044a
src/Test/Ast/OrderedList.ts
src/Test/Ast/OrderedList.ts
/// <reference path="../../../typings/mocha/mocha.d.ts" /> /// <reference path="../../../typings/chai/chai.d.ts" /> import { expect } from 'chai' import * as Up from '../../index' import { SyntaxNode } from '../../SyntaxNodes/SyntaxNode' import { LinkNode } from '../../SyntaxNodes/LinkNode' import { DocumentNode } from '../../SyntaxNodes/DocumentNode' import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode' import { StressNode } from '../../SyntaxNodes/StressNode' import { InlineCodeNode } from '../../SyntaxNodes/InlineCodeNode' import { RevisionInsertionNode } from '../../SyntaxNodes/RevisionInsertionNode' import { RevisionDeletionNode } from '../../SyntaxNodes/RevisionDeletionNode' import { SpoilerNode } from '../../SyntaxNodes/SpoilerNode' import { InlineAsideNode } from '../../SyntaxNodes/InlineAsideNode' import { ParagraphNode } from '../../SyntaxNodes/ParagraphNode' import { SectionSeparatorNode } from '../../SyntaxNodes/SectionSeparatorNode' import { HeadingNode } from '../../SyntaxNodes/HeadingNode' import { LineBlockNode } from '../../SyntaxNodes/LineBlockNode' import { LineNode } from '../../SyntaxNodes/LineNode' import { OrderedListNode } from '../../SyntaxNodes/OrderedListNode' import { OrderedListItemNode } from '../../SyntaxNodes/OrderedListItemNode' import { CodeBlockNode } from '../../SyntaxNodes/CodeBlockNode' describe('Consecutive lines bulleted by number signs followed by periods', () => { it('produce an ordered list node containing ordered list item nodes', () => { const text = ` #. Hello, world! #. Goodbye, world!` expect(Up.ast(text)).to.be.eql( new DocumentNode([ new OrderedListNode([ new OrderedListItemNode([ new ParagraphNode([ new PlainTextNode('Hello, world!') ]) ]), new OrderedListItemNode([ new ParagraphNode([ new PlainTextNode('Goodbye, world!') ]) ]) ]) ]) ) }) })
Add failing ordered list test
Add failing ordered list test
TypeScript
mit
start/up,start/up
--- +++ @@ -0,0 +1,50 @@ +/// <reference path="../../../typings/mocha/mocha.d.ts" /> +/// <reference path="../../../typings/chai/chai.d.ts" /> + +import { expect } from 'chai' +import * as Up from '../../index' +import { SyntaxNode } from '../../SyntaxNodes/SyntaxNode' +import { LinkNode } from '../../SyntaxNodes/LinkNode' +import { DocumentNode } from '../../SyntaxNodes/DocumentNode' +import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' +import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode' +import { StressNode } from '../../SyntaxNodes/StressNode' +import { InlineCodeNode } from '../../SyntaxNodes/InlineCodeNode' +import { RevisionInsertionNode } from '../../SyntaxNodes/RevisionInsertionNode' +import { RevisionDeletionNode } from '../../SyntaxNodes/RevisionDeletionNode' +import { SpoilerNode } from '../../SyntaxNodes/SpoilerNode' +import { InlineAsideNode } from '../../SyntaxNodes/InlineAsideNode' +import { ParagraphNode } from '../../SyntaxNodes/ParagraphNode' +import { SectionSeparatorNode } from '../../SyntaxNodes/SectionSeparatorNode' +import { HeadingNode } from '../../SyntaxNodes/HeadingNode' +import { LineBlockNode } from '../../SyntaxNodes/LineBlockNode' +import { LineNode } from '../../SyntaxNodes/LineNode' +import { OrderedListNode } from '../../SyntaxNodes/OrderedListNode' +import { OrderedListItemNode } from '../../SyntaxNodes/OrderedListItemNode' +import { CodeBlockNode } from '../../SyntaxNodes/CodeBlockNode' + + +describe('Consecutive lines bulleted by number signs followed by periods', () => { + it('produce an ordered list node containing ordered list item nodes', () => { + const text = + ` +#. Hello, world! +#. Goodbye, world!` + expect(Up.ast(text)).to.be.eql( + new DocumentNode([ + new OrderedListNode([ + new OrderedListItemNode([ + new ParagraphNode([ + new PlainTextNode('Hello, world!') + ]) + ]), + new OrderedListItemNode([ + new ParagraphNode([ + new PlainTextNode('Goodbye, world!') + ]) + ]) + ]) + ]) + ) + }) +})
5f178511caeb96021fa64676f560b658a8340d8c
types/p-cancelable/index.d.ts
types/p-cancelable/index.d.ts
// Type definitions for p-cancelable 0.3 // Project: https://github.com/sindresorhus/p-cancelable#readme // Definitions by: BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = PCancelable; declare const PCancelable: PCancelableConstructor; interface PCancelableConstructor extends PromiseConstructor { readonly prototype: PCancelable.PCancelable<any>; readonly CancelError: PCancelable.CancelErrorConstructor; fn<T, R>(wrapper: (onCancel: (fn?: () => void) => void, input: T) => PromiseLike<R>): (input: T) => PCancelable.PCancelable<R>; new<T>(executor: (onCancel: (fn?: () => void) => void, resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): PCancelable.PCancelable<T>; } declare namespace PCancelable { interface PCancelable<T> extends Promise<T> { readonly canceled: boolean; cancel(): void; } interface CancelErrorConstructor extends ErrorConstructor { new (): CancelError; } interface CancelError extends Error { readonly name: 'CancelError'; } }
// Type definitions for p-cancelable 0.5 // Project: https://github.com/sindresorhus/p-cancelable#readme // Definitions by: BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = PCancelable; declare const PCancelable: PCancelableConstructor; interface PCancelableConstructor extends PromiseConstructor { readonly prototype: PCancelable.PCancelable<any>; readonly CancelError: PCancelable.CancelErrorConstructor; fn<T, R>(wrapper: (onCancel: (fn?: () => void) => void, input: T) => PromiseLike<R>): (input: T) => PCancelable.PCancelable<R>; new<T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: (fn?: () => void) => void) => void): PCancelable.PCancelable<T>; } declare namespace PCancelable { interface PCancelable<T> extends Promise<T> { readonly isCanceled: boolean; cancel(reason?: string): void; } interface CancelErrorConstructor extends ErrorConstructor { new (reason?: string): CancelError; } interface CancelError extends Error { readonly name: 'CancelError'; readonly isCanceled: boolean; } }
Make p-cancellable types compatible with 0.5
Make p-cancellable types compatible with 0.5 - Append `onCancel` instead of prepending (https://github.com/sindresorhus/p-cancelable/commit/8e3aaec245492f3a38b5d4f74e9861cf3f334616) - Rename `PCancelable.canceled` to `PCancelable.isCanceled` (https://github.com/sindresorhus/p-cancelable/commit/433d25c8fcf08acd127f0249bc8377379c98363c) - Add `CancelError.isCanceled` (https://github.com/sindresorhus/p-cancelable/commit/ad14c228a9c53f939ed6de068cfe83b5fa27fe1c) - Add ability to provide cancel reason (https://github.com/sindresorhus/p-cancelable/commit/a97b12b309f7ab60f8bfa22883b052c17b32a04e)
TypeScript
mit
mcliment/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,borisyankov/DefinitelyTyped,markogresak/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,borisyankov/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,magny/DefinitelyTyped,dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped
--- +++ @@ -1,4 +1,4 @@ -// Type definitions for p-cancelable 0.3 +// Type definitions for p-cancelable 0.5 // Project: https://github.com/sindresorhus/p-cancelable#readme // Definitions by: BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,20 +11,22 @@ readonly prototype: PCancelable.PCancelable<any>; readonly CancelError: PCancelable.CancelErrorConstructor; fn<T, R>(wrapper: (onCancel: (fn?: () => void) => void, input: T) => PromiseLike<R>): (input: T) => PCancelable.PCancelable<R>; - new<T>(executor: (onCancel: (fn?: () => void) => void, resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): PCancelable.PCancelable<T>; + new<T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: (fn?: () => void) => void) => void): PCancelable.PCancelable<T>; } declare namespace PCancelable { interface PCancelable<T> extends Promise<T> { - readonly canceled: boolean; - cancel(): void; + readonly isCanceled: boolean; + cancel(reason?: string): void; + } interface CancelErrorConstructor extends ErrorConstructor { - new (): CancelError; + new (reason?: string): CancelError; } interface CancelError extends Error { readonly name: 'CancelError'; + readonly isCanceled: boolean; } }
2d7b039bb4227c3566012df8b08829bf529c2b72
src/handlers/InProgress.ts
src/handlers/InProgress.ts
import {Frame, ResponseContext, ResponseModel} from "../definitions/Handler"; import {Attributes, RequestContext} from "../definitions/SkillContext"; import * as Frames from "../definitions/FrameDirectory"; let entry = (attr: Attributes, ctx: RequestContext) => { let model = new ResponseModel(); model.speech = "you said no"; model.reprompt = "no again"; attr["myprop"] = "1"; return new ResponseContext(model); }; let actionMap = { "LaunchRequest": (attr: Attributes) => { attr["launch"] = 1; return Frames["Start"]; } }; let unhandled = () => { return Frames["Start"]; }; new Frame("InProgress", entry, unhandled, actionMap);
Add new handler for test.
Add new handler for test.
TypeScript
agpl-3.0
deegles/cookietime,deegles/cookietime
--- +++ @@ -0,0 +1,29 @@ +import {Frame, ResponseContext, ResponseModel} from "../definitions/Handler"; +import {Attributes, RequestContext} from "../definitions/SkillContext"; + +import * as Frames from "../definitions/FrameDirectory"; + +let entry = (attr: Attributes, ctx: RequestContext) => { + + let model = new ResponseModel(); + + model.speech = "you said no"; + model.reprompt = "no again"; + + attr["myprop"] = "1"; + + return new ResponseContext(model); +}; + +let actionMap = { + "LaunchRequest": (attr: Attributes) => { + attr["launch"] = 1; + return Frames["Start"]; + } +}; + +let unhandled = () => { + return Frames["Start"]; +}; + +new Frame("InProgress", entry, unhandled, actionMap);
278ddaa56566e133cb1e12440c859d955512e9e3
app/src/lib/git/diff-index.ts
app/src/lib/git/diff-index.ts
import { git } from './core' import { Repository } from '../../models/repository' export async function getChangedPathsInIndex(repository: Repository): Promise<string[]> { const result = await git([ 'diff-index', '--cached', '--name-only', '-z', 'HEAD' ], repository.path, 'getChangedPathsInIndex') return result.stdout.length ? result.stdout.split('\0') : [] }
Add a function for getting a list of files that have changed in the index
Add a function for getting a list of files that have changed in the index
TypeScript
mit
j-f1/forked-desktop,kactus-io/kactus,hjobrien/desktop,artivilla/desktop,kactus-io/kactus,gengjiawen/desktop,desktop/desktop,desktop/desktop,gengjiawen/desktop,shiftkey/desktop,desktop/desktop,j-f1/forked-desktop,kactus-io/kactus,desktop/desktop,hjobrien/desktop,say25/desktop,artivilla/desktop,j-f1/forked-desktop,hjobrien/desktop,gengjiawen/desktop,say25/desktop,artivilla/desktop,j-f1/forked-desktop,shiftkey/desktop,shiftkey/desktop,hjobrien/desktop,artivilla/desktop,kactus-io/kactus,gengjiawen/desktop,say25/desktop,shiftkey/desktop,say25/desktop
--- +++ @@ -0,0 +1,10 @@ +import { git } from './core' +import { Repository } from '../../models/repository' + +export async function getChangedPathsInIndex(repository: Repository): Promise<string[]> { + const result = await git([ 'diff-index', '--cached', '--name-only', '-z', 'HEAD' ], repository.path, 'getChangedPathsInIndex') + + return result.stdout.length + ? result.stdout.split('\0') + : [] +}
ca417366f5523c22da1000dbd6c4f6eb3c15eff5
src/resources/BotFramework.ts
src/resources/BotFramework.ts
import * as request from "request"; import {BotFrameworkActivity} from "../definitions/BotFrameworkService"; /** * Returns an answer to a question. */ export const sendActivity = function (activity: BotFrameworkActivity, serviceURL: string, conversationId: string, activityId: string, token: string): Promise<string> { return new Promise((resolve, reject) => { try { request.post({ headers: { "Content-Type": "application/json", "Authorization": `Bearer ${token}` }, url: `${serviceURL}v3/conversations/${conversationId}/activities${activityId ? "/" + activityId : ""}`, body: JSON.stringify(activity) }, function (error, response, body) { if (response.statusCode === 200) { let result = JSON.parse(body); resolve(result); } else { reject(error); } }); } catch (e) { console.log("EXCEPTION " + e); reject(e); } }); };
Add utility for sending activities to bot framework.
Add utility for sending activities to bot framework.
TypeScript
agpl-3.0
deegles/cookietime,deegles/cookietime
--- +++ @@ -0,0 +1,30 @@ +import * as request from "request"; +import {BotFrameworkActivity} from "../definitions/BotFrameworkService"; + +/** + * Returns an answer to a question. + */ +export const sendActivity = function (activity: BotFrameworkActivity, serviceURL: string, conversationId: string, activityId: string, token: string): Promise<string> { + return new Promise((resolve, reject) => { + try { + request.post({ + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${token}` + }, + url: `${serviceURL}v3/conversations/${conversationId}/activities${activityId ? "/" + activityId : ""}`, + body: JSON.stringify(activity) + }, function (error, response, body) { + if (response.statusCode === 200) { + let result = JSON.parse(body); + resolve(result); + } else { + reject(error); + } + }); + } catch (e) { + console.log("EXCEPTION " + e); + reject(e); + } + }); +};
38e405b5a368baa6bd92afbf0190ad971bad52c4
app/src/ui/schannel-no-revocation-check/schannel-no-revocation-check.tsx
app/src/ui/schannel-no-revocation-check/schannel-no-revocation-check.tsx
import * as React from 'react' import { Dialog, DialogContent, DialogFooter } from '../dialog' import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group' import { setGlobalConfigValue } from '../../lib/git' interface ISChannelNoRevocationCheckDialogProps { readonly url: string readonly onDismissed: () => void } interface ISChannelNoRevocationCheckDialogState { readonly loading: boolean } export class SChannelNoRevocationCheckDialog extends React.Component< ISChannelNoRevocationCheckDialogProps, ISChannelNoRevocationCheckDialogState > { public constructor(props: ISChannelNoRevocationCheckDialogProps) { super(props) this.state = { loading: false } } private onDisableRevocationChecks = async () => { this.setState({ loading: true }) await setGlobalConfigValue('http.schannelCheckRevoke', 'false') this.props.onDismissed() } public render() { return ( <Dialog title="Certificate revocation check failed" loading={this.state.loading} onDismissed={this.props.onDismissed} onSubmit={this.onDisableRevocationChecks} type="error" > <DialogContent> <p> Error when attempting to access '{this.props.url}', unable to perform certificate revocation check. See the Event Viewer for more details. </p> <p> A common cause for this error is This error is common when accessing the Internet through a corporate proxy server or a debugging proxy that performs SSL inspection. </p> <p> Would you like to turn off certificate revocation checks? You can change this at any time in options. </p> </DialogContent> <DialogFooter> <OkCancelButtonGroup okButtonText="Disable revocation checks" /> </DialogFooter> </Dialog> ) } }
Add an initial dialog for the schannel error
Add an initial dialog for the schannel error
TypeScript
mit
say25/desktop,desktop/desktop,j-f1/forked-desktop,artivilla/desktop,artivilla/desktop,kactus-io/kactus,desktop/desktop,j-f1/forked-desktop,j-f1/forked-desktop,kactus-io/kactus,say25/desktop,desktop/desktop,say25/desktop,artivilla/desktop,kactus-io/kactus,shiftkey/desktop,shiftkey/desktop,j-f1/forked-desktop,say25/desktop,desktop/desktop,kactus-io/kactus,shiftkey/desktop,artivilla/desktop,shiftkey/desktop
--- +++ @@ -0,0 +1,61 @@ +import * as React from 'react' +import { Dialog, DialogContent, DialogFooter } from '../dialog' +import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group' +import { setGlobalConfigValue } from '../../lib/git' + +interface ISChannelNoRevocationCheckDialogProps { + readonly url: string + + readonly onDismissed: () => void +} +interface ISChannelNoRevocationCheckDialogState { + readonly loading: boolean +} + +export class SChannelNoRevocationCheckDialog extends React.Component< + ISChannelNoRevocationCheckDialogProps, + ISChannelNoRevocationCheckDialogState +> { + public constructor(props: ISChannelNoRevocationCheckDialogProps) { + super(props) + this.state = { loading: false } + } + + private onDisableRevocationChecks = async () => { + this.setState({ loading: true }) + await setGlobalConfigValue('http.schannelCheckRevoke', 'false') + this.props.onDismissed() + } + + public render() { + return ( + <Dialog + title="Certificate revocation check failed" + loading={this.state.loading} + onDismissed={this.props.onDismissed} + onSubmit={this.onDisableRevocationChecks} + type="error" + > + <DialogContent> + <p> + Error when attempting to access '{this.props.url}', unable to + perform certificate revocation check. See the Event Viewer for more + details. + </p> + <p> + A common cause for this error is This error is common when accessing + the Internet through a corporate proxy server or a debugging proxy + that performs SSL inspection. + </p> + <p> + Would you like to turn off certificate revocation checks? You can + change this at any time in options. + </p> + </DialogContent> + <DialogFooter> + <OkCancelButtonGroup okButtonText="Disable revocation checks" /> + </DialogFooter> + </Dialog> + ) + } +}
d383595f1aafad7b1d5a38d52449d733f7a44853
webapp/src/app/router/app.routes.ts
webapp/src/app/router/app.routes.ts
import { provideRouter, RouterConfig } from '@angular/router'; import { LoginComponent } from "../login/login.component"; import { StudentProfileListComponent } from "../student-profile-list/student-profile-list.component"; import { GradeStudentListComponent } from "../grade-student-list/grade-student-list.component"; import { QuestionViewComponent } from "../question-view/question-view.component"; import { AssignmentListComponent } from "../assignment-list/assignment-list.component"; import { HomeComponent } from "../home/home.component"; export const routes: RouterConfig = [ { path: '', component: HomeComponent }, { path: 'assignments', component: AssignmentListComponent }, { path: 'questions', component: QuestionViewComponent }, { path: 'gradeStudent', component: GradeStudentListComponent }, { path: 'class', component: StudentProfileListComponent }, { path: 'login', component: LoginComponent }, ]; export const APP_ROUTER_PROVIDERS = [ provideRouter(routes) ];
Upgrade to angular rc3 and upgrade to new router
Upgrade to angular rc3 and upgrade to new router
TypeScript
mit
bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder
--- +++ @@ -0,0 +1,21 @@ +import { provideRouter, RouterConfig } from '@angular/router'; + +import { LoginComponent } from "../login/login.component"; +import { StudentProfileListComponent } from "../student-profile-list/student-profile-list.component"; +import { GradeStudentListComponent } from "../grade-student-list/grade-student-list.component"; +import { QuestionViewComponent } from "../question-view/question-view.component"; +import { AssignmentListComponent } from "../assignment-list/assignment-list.component"; +import { HomeComponent } from "../home/home.component"; + +export const routes: RouterConfig = [ + { path: '', component: HomeComponent }, + { path: 'assignments', component: AssignmentListComponent }, + { path: 'questions', component: QuestionViewComponent }, + { path: 'gradeStudent', component: GradeStudentListComponent }, + { path: 'class', component: StudentProfileListComponent }, + { path: 'login', component: LoginComponent }, +]; + +export const APP_ROUTER_PROVIDERS = [ + provideRouter(routes) +];
3f185078d8bdf57c6669b08a5ea135de65555d9d
types/list-stream/index.d.ts
types/list-stream/index.d.ts
// Type definitions for list-stream 1.0 // Project: https://github.com/rvagg/list-stream // Definitions by: IanStorm <https://github.com/IanStorm> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// <reference types="node" /> import { Duplex, DuplexOptions } from "stream"; interface ListStreamMethod { (callback?: (err: Error, data: any[]) => void): ListStream; (options?: DuplexOptions, callback?: (err: Error, data: any[]) => void): ListStream; } interface ListStreamConstructor extends ListStreamMethod { new(callback?: (err: Error, data: any[]) => void): ListStream; new(options?: DuplexOptions, callback?: (err: Error, data: any[]) => void): ListStream; obj: ListStreamMethod; } declare let ListStream: ListStreamConstructor; interface ListStream extends Duplex { append(chunk: any): void; duplicate(): ListStream; end(): void; get(index: number): any; length: number; } export = ListStream;
// Type definitions for list-stream 1.0 // Project: https://github.com/rvagg/list-stream // Definitions by: IanStorm <https://github.com/IanStorm> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 /// <reference types="node" /> import { Duplex, DuplexOptions } from "stream"; interface ListStreamMethod { (callback?: (err: Error, data: any[]) => void): ListStream; (options?: DuplexOptions, callback?: (err: Error, data: any[]) => void): ListStream; } interface ListStreamConstructor extends ListStreamMethod { new(callback?: (err: Error, data: any[]) => void): ListStream; new(options?: DuplexOptions, callback?: (err: Error, data: any[]) => void): ListStream; obj: ListStreamMethod; } declare let ListStream: ListStreamConstructor; interface ListStream extends Duplex { append(chunk: any): void; duplicate(): ListStream; end(): void; get(index: number): any; length: number; } export = ListStream;
Fix error while running `npm test`
Fix error while running `npm test`
TypeScript
mit
georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,dsebastien/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,markogresak/DefinitelyTyped,mcliment/DefinitelyTyped,magny/DefinitelyTyped,borisyankov/DefinitelyTyped
--- +++ @@ -2,6 +2,7 @@ // Project: https://github.com/rvagg/list-stream // Definitions by: IanStorm <https://github.com/IanStorm> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 /// <reference types="node" />
039d3ea8c6afb27fa129adad27e3ec53f9462070
packages/skin-database/migrations/20201202012156_remove_tweet_url.ts
packages/skin-database/migrations/20201202012156_remove_tweet_url.ts
import * as Knex from "knex"; export async function up(knex: Knex): Promise<any> { await knex.schema.table("tweets", function (table) { table.dropColumn("url"); }); } export async function down(knex: Knex): Promise<any> { await knex.schema.table("tweets", function (table) { table.text("url"); }); }
Remove tweet url field. It can be infered.
Remove tweet url field. It can be infered.
TypeScript
mit
captbaritone/winamp2-js,captbaritone/winamp2-js,captbaritone/winamp2-js
--- +++ @@ -0,0 +1,13 @@ +import * as Knex from "knex"; + +export async function up(knex: Knex): Promise<any> { + await knex.schema.table("tweets", function (table) { + table.dropColumn("url"); + }); +} + +export async function down(knex: Knex): Promise<any> { + await knex.schema.table("tweets", function (table) { + table.text("url"); + }); +}
14f0d33f791af59891a7a71a02ed7c014dfd19f2
src/Test/Ast/Config/Image.ts
src/Test/Ast/Config/Image.ts
import { expect } from 'chai' import { Up } from '../../../index' import { insideDocumentAndParagraph } from '../Helpers' import { ImageNode } from '../../../SyntaxNodes/ImageNode' import { DocumentNode } from '../../../SyntaxNodes/DocumentNode' describe('The term that represents image conventions', () => { const up = new Up({ i18n: { terms: { image: 'see' } } }) it('comes from the "audio" config term', () => { const text = '[see: Chrono Cross logo -> https://example.com/cc.png]' expect(up.toAst(text)).to.be.eql( new DocumentNode([ new ImageNode('Chrono Cross logo', 'https://example.com/cc.png') ]) ) }) it('is always case insensitive', () => { const lowercase = '[see: Chrono Cross logo -> https://example.com/cc.png]' const misedCase = '[SeE: Chrono Cross logo -> https://example.com/cc.png]' expect(up.toAst(misedCase)).to.be.eql(up.toAst(lowercase)) }) })
Add 2 passing config tests
Add 2 passing config tests
TypeScript
mit
start/up,start/up
--- +++ @@ -0,0 +1,31 @@ +import { expect } from 'chai' +import { Up } from '../../../index' +import { insideDocumentAndParagraph } from '../Helpers' +import { ImageNode } from '../../../SyntaxNodes/ImageNode' +import { DocumentNode } from '../../../SyntaxNodes/DocumentNode' + + +describe('The term that represents image conventions', () => { + const up = new Up({ + i18n: { + terms: { image: 'see' } + } + }) + + it('comes from the "audio" config term', () => { + const text = '[see: Chrono Cross logo -> https://example.com/cc.png]' + + expect(up.toAst(text)).to.be.eql( + new DocumentNode([ + new ImageNode('Chrono Cross logo', 'https://example.com/cc.png') + ]) + ) + }) + + it('is always case insensitive', () => { + const lowercase = '[see: Chrono Cross logo -> https://example.com/cc.png]' + const misedCase = '[SeE: Chrono Cross logo -> https://example.com/cc.png]' + + expect(up.toAst(misedCase)).to.be.eql(up.toAst(lowercase)) + }) +})
539633af43d232be18d1792ef27e023531c3305d
types/koa-cors/koa-cors-tests.ts
types/koa-cors/koa-cors-tests.ts
import * as Koa from 'koa'; import * as KoaCors from 'koa-cors'; new Koa() .use(KoaCors()) .use(KoaCors({})) .use(KoaCors({ origin: '*' }));
import Koa = require('koa'); import KoaCors = require('koa-cors'); const app = new Koa(); app.use(KoaCors()); app.use(KoaCors({})); app.use(KoaCors({ origin: '*' }));
Fix how modules are imported
Fix how modules are imported
TypeScript
mit
markogresak/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped,dsebastien/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,mcliment/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,magny/DefinitelyTyped
--- +++ @@ -1,7 +1,7 @@ -import * as Koa from 'koa'; -import * as KoaCors from 'koa-cors'; +import Koa = require('koa'); +import KoaCors = require('koa-cors'); -new Koa() - .use(KoaCors()) - .use(KoaCors({})) - .use(KoaCors({ origin: '*' })); +const app = new Koa(); +app.use(KoaCors()); +app.use(KoaCors({})); +app.use(KoaCors({ origin: '*' }));
e8ed3007deb5dc8b6fefc22752ab68be369f3e0e
types/mustache/mustache-tests.ts
types/mustache/mustache-tests.ts
var view1 = { title: "Joe", calc: function () { return 2 + 4; } }; var template1 = "{{title}} spends {{calc}}"; var output = Mustache.render(template1, view1); var view2 = { forename: "Jane", calc: function () { return 10 + 5; } }; var template2 = "{{forename}} spends {{calc}}"; Mustache.parse(template2, null); var output2 = Mustache.render(template2, view2); var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" }; var template3 = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}"; var html = Mustache.to_html(template3, view3);
var view1 = { title: "Joe", calc: function () { return 2 + 4; } }; var template1 = "{{title}} spends {{calc}}"; var output = Mustache.render(template1, view1); var view2 = { forename: "Jane", calc: function () { return 10 + 5; } }; var template2 = "{{forename}} spends {{calc}}"; Mustache.parse(template2, null); var output2 = Mustache.render(template2, view2); var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" }; var template3 = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}"; var html = Mustache.to_html(template3, view3); var view4 = new class extends Mustache.Context { constructor() { super({}); } public lookup(name: string) { return name.toUpperCase(); } }; var template4 = "Hello, {{firstName}} {{lastName}}"; var html4 = Mustache.render(template4, view4);
Add a test for testing constructors
Add a test for testing constructors
TypeScript
mit
mcliment/DefinitelyTyped,borisyankov/DefinitelyTyped,AgentME/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,borisyankov/DefinitelyTyped,AgentME/DefinitelyTyped,dsebastien/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,markogresak/DefinitelyTyped,AgentME/DefinitelyTyped,dsebastien/DefinitelyTyped
--- +++ @@ -12,3 +12,18 @@ var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" }; var template3 = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}"; var html = Mustache.to_html(template3, view3); + +var view4 = new class extends Mustache.Context +{ + constructor() + { + super({}); + } + + public lookup(name: string) + { + return name.toUpperCase(); + } +}; +var template4 = "Hello, {{firstName}} {{lastName}}"; +var html4 = Mustache.render(template4, view4);
50b123cda4f55daee0cc40809f121cfcbb4f92ba
scripts/configureAlgolia.ts
scripts/configureAlgolia.ts
import * as algoliasearch from 'algoliasearch' import * as _ from 'lodash' import { ALGOLIA_ID } from 'settings' import { ALGOLIA_SECRET_KEY } from 'serverSettings' // This function initializes and applies settings to the Algolia search indices // Algolia settings should be configured here rather than in the Algolia dashboard UI, as then // they are recorded and transferrable across dev/prod instances async function configureAlgolia() { const client = algoliasearch(ALGOLIA_ID, ALGOLIA_SECRET_KEY) const chartsIndex = client.initIndex('charts') await chartsIndex.setSettings({ searchableAttributes: ["unordered(title)", "unordered(variantName)", "unordered(subtitle)", "unordered(tagsText)"], ranking: ["exact", "typo", "attribute", "words", "proximity", "custom"], customRanking: ["asc(numDimensions)", "asc(titleLength)"], attributesToSnippet: ["subtitle:24"] }) const pagesIndex = client.initIndex('pages') await pagesIndex.setSettings({ searchableAttributes: ["title", "content"], attributesToSnippet: ["content:24"] }) const synonyms = [ ['kids', 'children'], ['pork', 'pigmeat'] ] const algoliaSynonyms = synonyms.map(s => { return { objectID: s.join("-"), type: 'synonym', synonyms: s } as algoliasearch.Synonym }) await pagesIndex.batchSynonyms(algoliaSynonyms, { replaceExistingSynonyms: true }) await chartsIndex.batchSynonyms(algoliaSynonyms, { replaceExistingSynonyms: true }) } configureAlgolia()
Add script to configure algolia indices from scratch
Add script to configure algolia indices from scratch
TypeScript
mit
OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher
--- +++ @@ -0,0 +1,45 @@ +import * as algoliasearch from 'algoliasearch' +import * as _ from 'lodash' + +import { ALGOLIA_ID } from 'settings' +import { ALGOLIA_SECRET_KEY } from 'serverSettings' + +// This function initializes and applies settings to the Algolia search indices +// Algolia settings should be configured here rather than in the Algolia dashboard UI, as then +// they are recorded and transferrable across dev/prod instances +async function configureAlgolia() { + const client = algoliasearch(ALGOLIA_ID, ALGOLIA_SECRET_KEY) + const chartsIndex = client.initIndex('charts') + + await chartsIndex.setSettings({ + searchableAttributes: ["unordered(title)", "unordered(variantName)", "unordered(subtitle)", "unordered(tagsText)"], + ranking: ["exact", "typo", "attribute", "words", "proximity", "custom"], + customRanking: ["asc(numDimensions)", "asc(titleLength)"], + attributesToSnippet: ["subtitle:24"] + }) + + const pagesIndex = client.initIndex('pages') + + await pagesIndex.setSettings({ + searchableAttributes: ["title", "content"], + attributesToSnippet: ["content:24"] + }) + + const synonyms = [ + ['kids', 'children'], + ['pork', 'pigmeat'] + ] + + const algoliaSynonyms = synonyms.map(s => { + return { + objectID: s.join("-"), + type: 'synonym', + synonyms: s + } as algoliasearch.Synonym + }) + + await pagesIndex.batchSynonyms(algoliaSynonyms, { replaceExistingSynonyms: true }) + await chartsIndex.batchSynonyms(algoliaSynonyms, { replaceExistingSynonyms: true }) +} + +configureAlgolia()
467ee98072e9b29a95bddd855def7e11181e5d12
shoedesktop_hr.ts
shoedesktop_hr.ts
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="hr_HR"> <context> <name>ShowDesktop</name> <message> <location filename="../showdesktop.cpp" line="48"/> <source>Show desktop</source> <translation type="unfinished">Pokaži radnu površinu</translation> </message> <message> <location filename="../showdesktop.cpp" line="69"/> <source>Show Desktop: Global shortcut &apos;%1&apos; cannot be registered</source> <translation type="unfinished"></translation> </message> <message> <location filename="../showdesktop.cpp" line="55"/> <source>Show Desktop</source> <translation type="unfinished">Pokaži Radnu površinu</translation> </message> </context> </TS>
Create HR translations for panel and plugins
Create HR translations for panel and plugins
TypeScript
lgpl-2.1
lxde/lxqt-l10n
--- +++ @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="hr_HR"> +<context> + <name>ShowDesktop</name> + <message> + <location filename="../showdesktop.cpp" line="48"/> + <source>Show desktop</source> + <translation type="unfinished">Pokaži radnu površinu</translation> + </message> + <message> + <location filename="../showdesktop.cpp" line="69"/> + <source>Show Desktop: Global shortcut &apos;%1&apos; cannot be registered</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../showdesktop.cpp" line="55"/> + <source>Show Desktop</source> + <translation type="unfinished">Pokaži Radnu površinu</translation> + </message> +</context> +</TS>
bfeccd70eceb8d584e8a5cb0318416db49f37c72
src/actions/api.ts
src/actions/api.ts
import { API_LIMIT_EXCEEDED } from '../constants'; import { GroupId } from 'types'; export interface ApiRateLimitExceeded { readonly type: API_LIMIT_EXCEEDED; readonly watcherId: GroupId; } export const watcherExceededApiLimit = ( watcherId: GroupId ): ApiRateLimitExceeded => ({ type: API_LIMIT_EXCEEDED, watcherId });
Add action creator for ApiRateLimitExceeded.
Add action creator for ApiRateLimitExceeded.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -0,0 +1,14 @@ +import { API_LIMIT_EXCEEDED } from '../constants'; +import { GroupId } from 'types'; + +export interface ApiRateLimitExceeded { + readonly type: API_LIMIT_EXCEEDED; + readonly watcherId: GroupId; +} + +export const watcherExceededApiLimit = ( + watcherId: GroupId +): ApiRateLimitExceeded => ({ + type: API_LIMIT_EXCEEDED, + watcherId +});
fe12bd4cb1ab81c592a77cd71f084d487ff0e166
test-d/implementation-result.ts
test-d/implementation-result.ts
import test from '..'; test('return a promise-like', t => { return { then(resolve) { resolve?.(); } }; }); test('return a subscribable', t => { return { subscribe({complete}) { complete(); } }; }); test('return anything else', t => { return { foo: 'bar', subscribe() {}, then() {} }; });
Add test for implementation result types
Add test for implementation result types
TypeScript
mit
avajs/ava,sindresorhus/ava,avajs/ava
--- +++ @@ -0,0 +1,25 @@ +import test from '..'; + +test('return a promise-like', t => { + return { + then(resolve) { + resolve?.(); + } + }; +}); + +test('return a subscribable', t => { + return { + subscribe({complete}) { + complete(); + } + }; +}); + +test('return anything else', t => { + return { + foo: 'bar', + subscribe() {}, + then() {} + }; +});
c11cfd4def38229d1db7014c047017c80a7f1aa5
src/selectors/watcherTimers.ts
src/selectors/watcherTimers.ts
import { createSelector } from 'reselect'; import { watcherTimersSelector } from '.'; import { getWatcherIdsAssignedToFolder } from './watcherFolders'; export const numActiveWatchersInFolder = (folderId: string) => createSelector( [watcherTimersSelector, getWatcherIdsAssignedToFolder(folderId)], (watcherTimers, watcherIds) => watcherIds.reduce( (acc, cur): number => (watcherTimers.has(cur) ? acc + 1 : acc), 0 ) );
Add selector to determine the number of active watchers in a folder.
Add selector to determine the number of active watchers in a folder.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -0,0 +1,13 @@ +import { createSelector } from 'reselect'; +import { watcherTimersSelector } from '.'; +import { getWatcherIdsAssignedToFolder } from './watcherFolders'; + +export const numActiveWatchersInFolder = (folderId: string) => + createSelector( + [watcherTimersSelector, getWatcherIdsAssignedToFolder(folderId)], + (watcherTimers, watcherIds) => + watcherIds.reduce( + (acc, cur): number => (watcherTimers.has(cur) ? acc + 1 : acc), + 0 + ) + );
0a439f3e15b725b80d614c62e85f9a153e38c4c1
TypeScript/HackerRank/Practice/Data-Structures/Linked-Lists/insert-node-at-head.ts
TypeScript/HackerRank/Practice/Data-Structures/Linked-Lists/insert-node-at-head.ts
import * as fs from 'fs'; process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputString: any = ''; let currentLine = 0; process.stdin.on('data', inputStdin => { inputString += inputStdin; }); process.stdin.on('end', function () { inputString = inputString.replace(/\s*$/, '') .split('\n') .map(str => str.replace(/\s*$/, '')); main(); }); function readLine() { return inputString[currentLine++]; } /* * For your reference: * * SinglyLinkedListNode { * int data; * SinglyLinkedListNode next; * } * */ export function insertNodeAtHead(head: SinglyLinkedListNode, data: number) { const newNode = new SinglyLinkedListNode(data); newNode.next = head; return newNode; } class SinglyLinkedListNode { public data: number; public next: SinglyLinkedListNode; constructor(nodeData: number) { this.data = nodeData; this.next = null; } }; class SinglyLinkedList { public head: SinglyLinkedListNode; public tail: SinglyLinkedListNode; constructor() { this.head = null; this.tail = null; } }; function printSinglyLinkedList(node, sep, ws) { while (node != null) { ws.write(String(node.data)); node = node.next; if (node != null) { ws.write(sep); } } } function main() { const ws = fs.createWriteStream(process.env.OUTPUT_PATH); const llistCount = parseInt(readLine(), 10); let llist = new SinglyLinkedList(); for (let i = 0; i < llistCount; i++) { const llistItem = parseInt(readLine(), 10); const llist_head = insertNodeAtHead(llist.head, llistItem); llist.head = llist_head; } printSinglyLinkedList(llist.head, '\n', ws); ws.write('\n'); ws.end(); }
Create implementation of insert node at head.
Create implementation of insert node at head.
TypeScript
mit
Goyatuzo/Challenges,Goyatuzo/Challenges,Goyatuzo/Challenges,Goyatuzo/Challenges
--- +++ @@ -0,0 +1,93 @@ +import * as fs from 'fs'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString: any = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', function () { + inputString = inputString.replace(/\s*$/, '') + .split('\n') + .map(str => str.replace(/\s*$/, '')); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} + +/* + * For your reference: + * + * SinglyLinkedListNode { + * int data; + * SinglyLinkedListNode next; + * } + * + */ +export function insertNodeAtHead(head: SinglyLinkedListNode, data: number) { + const newNode = new SinglyLinkedListNode(data); + + newNode.next = head; + + return newNode; +} + +class SinglyLinkedListNode { + public data: number; + public next: SinglyLinkedListNode; + + constructor(nodeData: number) { + this.data = nodeData; + this.next = null; + } +}; + +class SinglyLinkedList { + public head: SinglyLinkedListNode; + public tail: SinglyLinkedListNode; + + constructor() { + this.head = null; + this.tail = null; + } +}; + +function printSinglyLinkedList(node, sep, ws) { + while (node != null) { + ws.write(String(node.data)); + + node = node.next; + + if (node != null) { + ws.write(sep); + } + } +} + +function main() { + const ws = fs.createWriteStream(process.env.OUTPUT_PATH); + + const llistCount = parseInt(readLine(), 10); + + let llist = new SinglyLinkedList(); + + for (let i = 0; i < llistCount; i++) { + const llistItem = parseInt(readLine(), 10); + const llist_head = insertNodeAtHead(llist.head, llistItem); + llist.head = llist_head; + } + + + + printSinglyLinkedList(llist.head, '\n', ws); + ws.write('\n'); + + ws.end(); +}
ec37be51de234cc84ffb6013e72c3cefe51ac09e
lib/helpers/scrollEventMock.ts
lib/helpers/scrollEventMock.ts
import { NativeSyntheticEvent, NativeScrollEvent, NativeScrollPoint, } from 'react-native'; export default ( contentOffset?: NativeScrollPoint, ): NativeSyntheticEvent<NativeScrollEvent> => ({ nativeEvent: { contentOffset: { x: 0, y: 50, ...contentOffset }, contentInset: { top: 0, right: 0, left: 0, bottom: 0 }, contentSize: { width: 0, height: 0 }, layoutMeasurement: { width: 0, height: 0 }, zoomScale: 1, }, bubbles: false, cancelable: false, currentTarget: 0, defaultPrevented: false, eventPhase: 0, isDefaultPrevented: () => false, isPropagationStopped: () => false, isTrusted: false, persist: () => {}, preventDefault: () => {}, stopPropagation: () => false, target: 0, timeStamp: 0, type: '', });
Add scroll event mock generator
Add scroll event mock generator
TypeScript
mit
hamidhadi/react-native-stretchy,hamidhadi/react-native-stretchy,hamidhadi/react-native-stretchy,hamidhadi/react-native-stretchy
--- +++ @@ -0,0 +1,31 @@ +import { + NativeSyntheticEvent, + NativeScrollEvent, + NativeScrollPoint, +} from 'react-native'; + +export default ( + contentOffset?: NativeScrollPoint, +): NativeSyntheticEvent<NativeScrollEvent> => ({ + nativeEvent: { + contentOffset: { x: 0, y: 50, ...contentOffset }, + contentInset: { top: 0, right: 0, left: 0, bottom: 0 }, + contentSize: { width: 0, height: 0 }, + layoutMeasurement: { width: 0, height: 0 }, + zoomScale: 1, + }, + bubbles: false, + cancelable: false, + currentTarget: 0, + defaultPrevented: false, + eventPhase: 0, + isDefaultPrevented: () => false, + isPropagationStopped: () => false, + isTrusted: false, + persist: () => {}, + preventDefault: () => {}, + stopPropagation: () => false, + target: 0, + timeStamp: 0, + type: '', +});
4b572e1b66ef7aed1a52f2b8f29eb2c5bbfff592
dock-spawn/dock-spawn-tests.ts
dock-spawn/dock-spawn-tests.ts
/// <reference path="dock-spawn.d.ts" /> var dockManagerDiv = document.createElement('div'), panelDiv1 = document.createElement('div'), panelDiv2 = document.createElement('div'), panelDiv3 = document.createElement('div'); document.body.appendChild(dockManagerDiv); var dockManager = new dockspawn.DockManager(dockManagerDiv); dockManager.initialize(); var panelContainer1 = new dockspawn.PanelContainer(panelDiv1, dockManager), panelContainer2 = new dockspawn.PanelContainer(panelDiv2, dockManager), panelContainer3 = new dockspawn.PanelContainer(panelDiv3, dockManager); var documentNode = dockManager.context.model.documentManagerNode; var panelNode1 = dockManager.dockLeft(documentNode, panelContainer1, 0.33), panelNode2 = dockManager.dockRight(documentNode, panelContainer2, 0.33), panelNode3 = dockManager.dockFill(documentNode, panelContainer3);
Add tests for "dock-spawn" library.
Add tests for "dock-spawn" library.
TypeScript
mit
wilfrem/DefinitelyTyped,TildaLabs/DefinitelyTyped,david-driscoll/DefinitelyTyped,sandersky/DefinitelyTyped,robl499/DefinitelyTyped,abbasmhd/DefinitelyTyped,ajtowf/DefinitelyTyped,pocke/DefinitelyTyped,sledorze/DefinitelyTyped,GodsBreath/DefinitelyTyped,lukehoban/DefinitelyTyped,jbrantly/DefinitelyTyped,moonpyk/DefinitelyTyped,bkristensen/DefinitelyTyped,timjk/DefinitelyTyped,rockclimber90/DefinitelyTyped,mcrawshaw/DefinitelyTyped,newclear/DefinitelyTyped,tan9/DefinitelyTyped,yuit/DefinitelyTyped,dwango-js/DefinitelyTyped,igorraush/DefinitelyTyped,psnider/DefinitelyTyped,dsebastien/DefinitelyTyped,jaysoo/DefinitelyTyped,abner/DefinitelyTyped,quantumman/DefinitelyTyped,YousefED/DefinitelyTyped,nitintutlani/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,david-driscoll/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,trystanclarke/DefinitelyTyped,gandjustas/DefinitelyTyped,johnnycrab/DefinitelyTyped,algas/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,philippstucki/DefinitelyTyped,optical/DefinitelyTyped,paulbakker/DefinitelyTyped,shahata/DefinitelyTyped,MugeSo/DefinitelyTyped,whoeverest/DefinitelyTyped,donnut/DefinitelyTyped,reppners/DefinitelyTyped,Gmulti/DefinitelyTyped,Karabur/DefinitelyTyped,Kuniwak/DefinitelyTyped,OpenMaths/DefinitelyTyped,thSoft/DefinitelyTyped,vagarenko/DefinitelyTyped,lucyhe/DefinitelyTyped,pkaul/DefinitelyTyped,opichals/DefinitelyTyped,DenEwout/DefinitelyTyped,syuilo/DefinitelyTyped,syuilo/DefinitelyTyped,rfranco/DefinitelyTyped,basp/DefinitelyTyped,takfjt/DefinitelyTyped,progre/DefinitelyTyped,GregOnNet/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,ecramer89/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,michaelbromley/DefinitelyTyped,zalamtech/DefinitelyTyped,alvarorahul/DefinitelyTyped,Belelros/DefinitelyTyped,vasek17/DefinitelyTyped,thSoft/DefinitelyTyped,JoshRosen/DefinitelyTyped,KonaTeam/DefinitelyTyped,toedter/DefinitelyTyped,samdark/DefinitelyTyped,teddyward/DefinitelyTyped,kanreisa/DefinitelyTyped,hiraash/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,use-strict/DefinitelyTyped,aqua89/DefinitelyTyped,bdoss/DefinitelyTyped,HereSinceres/DefinitelyTyped,Fraegle/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,subash-a/DefinitelyTyped,jiaz/DefinitelyTyped,minodisk/DefinitelyTyped,subjectix/DefinitelyTyped,mjjames/DefinitelyTyped,paypac/DefinitelyTyped,olemp/DefinitelyTyped,hatz48/DefinitelyTyped,paypac/DefinitelyTyped,philippstucki/DefinitelyTyped,teves-castro/DefinitelyTyped,gyohk/DefinitelyTyped,mvarblow/DefinitelyTyped,brentonhouse/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,rcchen/DefinitelyTyped,arusakov/DefinitelyTyped,applesaucers/lodash-invokeMap,xica/DefinitelyTyped,vpineda1996/DefinitelyTyped,Dominator008/DefinitelyTyped,johnnycrab/DefinitelyTyped,Airblader/DefinitelyTyped,laball/DefinitelyTyped,dariajung/DefinitelyTyped,tjoskar/DefinitelyTyped,DeadAlready/DefinitelyTyped,sclausen/DefinitelyTyped,aindlq/DefinitelyTyped,biomassives/DefinitelyTyped,arusakov/DefinitelyTyped,vsavkin/DefinitelyTyped,stacktracejs/DefinitelyTyped,johan-gorter/DefinitelyTyped,dumbmatter/DefinitelyTyped,PawelStroinski/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,miguelmq/DefinitelyTyped,MugeSo/DefinitelyTyped,Almouro/DefinitelyTyped,hx0day/DefinitelyTyped,RX14/DefinitelyTyped,nodeframe/DefinitelyTyped,nseckinoral/DefinitelyTyped,yuit/DefinitelyTyped,pkaul/DefinitelyTyped,georgemarshall/DefinitelyTyped,almstrand/DefinitelyTyped,Airblader/DefinitelyTyped,dpsthree/DefinitelyTyped,thSoft/DefinitelyTyped,ducin/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,alextkachman/DefinitelyTyped,MidnightDesign/DefinitelyTyped,Airblader/DefinitelyTyped,blink1073/DefinitelyTyped,takenet/DefinitelyTyped,akonwi/DefinitelyTyped,arma-gast/DefinitelyTyped,jesseschalken/DefinitelyTyped,davidpricedev/DefinitelyTyped,lbesson/DefinitelyTyped,vote539/DefinitelyTyped,mattanja/DefinitelyTyped,nobuoka/DefinitelyTyped,Trapulo/DefinitelyTyped,PawelStroinski/DefinitelyTyped,UzEE/DefinitelyTyped,damianog/DefinitelyTyped,wkrueger/DefinitelyTyped,the41/DefinitelyTyped,HPFOD/DefinitelyTyped,dflor003/DefinitelyTyped,xswordsx/DefinitelyTyped,mhegazy/DefinitelyTyped,mcliment/DefinitelyTyped,ArturSoler/DefinitelyTyped,bayitajesi/DefinitelyTyped,sclausen/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,gcastre/DefinitelyTyped,hatz48/DefinitelyTyped,jasonswearingen/DefinitelyTyped,Syati/DefinitelyTyped,jimthedev/DefinitelyTyped,Pro/DefinitelyTyped,chrismbarr/DefinitelyTyped,Belelros/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,pwelter34/DefinitelyTyped,smrq/DefinitelyTyped,tarruda/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,bardt/DefinitelyTyped,eugenpodaru/DefinitelyTyped,nmalaguti/DefinitelyTyped,scriby/DefinitelyTyped,pkaul/DefinitelyTyped,wilfrem/DefinitelyTyped,donnut/DefinitelyTyped,unknownloner/DefinitelyTyped,innerverse/DefinitelyTyped,erosb/DefinitelyTyped,timramone/DefinitelyTyped,toedter/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,igorsechyn/DefinitelyTyped,amanmahajan7/DefinitelyTyped,QuatroCode/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,Belelros/DefinitelyTyped,cherrydev/DefinitelyTyped,scriby/DefinitelyTyped,davidpricedev/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,jacqt/DefinitelyTyped,stacktracejs/DefinitelyTyped,aaharu/DefinitelyTyped,vagarenko/DefinitelyTyped,ryan10132/DefinitelyTyped,paulmorphy/DefinitelyTyped,furny/DefinitelyTyped,musically-ut/DefinitelyTyped,nycdotnet/DefinitelyTyped,anweiss/DefinitelyTyped,shlomiassaf/DefinitelyTyped,kuon/DefinitelyTyped,evandrewry/DefinitelyTyped,newclear/DefinitelyTyped,superduper/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,maglar0/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,egeland/DefinitelyTyped,bdukes/DefinitelyTyped,abner/DefinitelyTyped,mattblang/DefinitelyTyped,Lorisu/DefinitelyTyped,jraymakers/DefinitelyTyped,borisyankov/DefinitelyTyped,Airblader/DefinitelyTyped,georgemarshall/DefinitelyTyped,giggio/DefinitelyTyped,pkhayundi/DefinitelyTyped,balassy/DefinitelyTyped,xStrom/DefinitelyTyped,samwgoldman/DefinitelyTyped,Seikho/DefinitelyTyped,abmohan/DefinitelyTyped,chrismbarr/DefinitelyTyped,haskellcamargo/DefinitelyTyped,Pipe-shen/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,tboyce/DefinitelyTyped,JoshRosen/DefinitelyTyped,brettle/DefinitelyTyped,alextkachman/DefinitelyTyped,iislucas/DefinitelyTyped,RX14/DefinitelyTyped,gorcz/DefinitelyTyped,felipe3dfx/DefinitelyTyped,deeleman/DefinitelyTyped,leoromanovsky/DefinitelyTyped,PascalSenn/DefinitelyTyped,onecentlin/DefinitelyTyped,one-pieces/DefinitelyTyped,Seltzer/DefinitelyTyped,aaharu/DefinitelyTyped,Pro/DefinitelyTyped,stylelab-io/DefinitelyTyped,paulmorphy/DefinitelyTyped,esperco/DefinitelyTyped,tomtarrot/DefinitelyTyped,benliddicott/DefinitelyTyped,Litee/DefinitelyTyped,fnipo/DefinitelyTyped,stimms/DefinitelyTyped,lightswitch05/DefinitelyTyped,brainded/DefinitelyTyped,bobslaede/DefinitelyTyped,dydek/DefinitelyTyped,schmuli/DefinitelyTyped,DeluxZ/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,tgrospic/DefinitelyTyped,progre/DefinitelyTyped,borisyankov/DefinitelyTyped,JaminFarr/DefinitelyTyped,jeremyhayes/DefinitelyTyped,trystanclarke/DefinitelyTyped,Zenorbi/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,harcher81/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,gregoryagu/DefinitelyTyped,bennett000/DefinitelyTyped,bluong/DefinitelyTyped,nakakura/DefinitelyTyped,mendix/DefinitelyTyped,AgentME/DefinitelyTyped,rschmukler/DefinitelyTyped,arcticwaters/DefinitelyTyped,raijinsetsu/DefinitelyTyped,stimms/DefinitelyTyped,manekovskiy/DefinitelyTyped,kmeurer/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,sixinli/DefinitelyTyped,drinchev/DefinitelyTyped,mrk21/DefinitelyTyped,Zorgatone/DefinitelyTyped,CSharpFan/DefinitelyTyped,olivierlemasle/DefinitelyTyped,fredgalvao/DefinitelyTyped,behzad88/DefinitelyTyped,aroder/DefinitelyTyped,zuzusik/DefinitelyTyped,maxlang/DefinitelyTyped,danfma/DefinitelyTyped,michalczukm/DefinitelyTyped,elisee/DefinitelyTyped,JoshRosen/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,greglo/DefinitelyTyped,dmoonfire/DefinitelyTyped,QuatroCode/DefinitelyTyped,vote539/DefinitelyTyped,raijinsetsu/DefinitelyTyped,eekboom/DefinitelyTyped,ArturSoler/DefinitelyTyped,herrmanno/DefinitelyTyped,tdmckinn/DefinitelyTyped,mjjames/DefinitelyTyped,pkaul/DefinitelyTyped,Saneyan/DefinitelyTyped,chrootsu/DefinitelyTyped,takenet/DefinitelyTyped,JoshRosen/DefinitelyTyped,wilkerlucio/DefinitelyTyped,philippsimon/DefinitelyTyped,paypac/DefinitelyTyped,RedSeal-co/DefinitelyTyped,bilou84/DefinitelyTyped,nabeix/DefinitelyTyped,micurs/DefinitelyTyped,akonwi/DefinitelyTyped,wilkerlucio/DefinitelyTyped,scatcher/DefinitelyTyped,jtlan/DefinitelyTyped,georgemarshall/DefinitelyTyped,gdi2290/DefinitelyTyped,grahammendick/DefinitelyTyped,markogresak/DefinitelyTyped,chrilith/DefinitelyTyped,Ptival/DefinitelyTyped,emanuelhp/DefinitelyTyped,MarlonFan/DefinitelyTyped,goaty92/DefinitelyTyped,Dashlane/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,bruennijs/DefinitelyTyped,axelcostaspena/DefinitelyTyped,benishouga/DefinitelyTyped,alexdresko/DefinitelyTyped,aciccarello/DefinitelyTyped,dsebastien/DefinitelyTyped,lbguilherme/DefinitelyTyped,emanuelhp/DefinitelyTyped,LordJZ/DefinitelyTyped,Zzzen/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,tomtheisen/DefinitelyTyped,laco0416/DefinitelyTyped,david-driscoll/DefinitelyTyped,hesselink/DefinitelyTyped,hypno2000/typings,Jwsonic/DefinitelyTyped,modifyink/DefinitelyTyped,tinganho/DefinitelyTyped,rolandzwaga/DefinitelyTyped,axefrog/DefinitelyTyped,WritingPanda/DefinitelyTyped,chadoliver/DefinitelyTyped,mrozhin/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,jimthedev/DefinitelyTyped,rolandzwaga/DefinitelyTyped,martinduparc/DefinitelyTyped,jraymakers/DefinitelyTyped,amanmahajan7/DefinitelyTyped,wbuchwalter/DefinitelyTyped,mwain/DefinitelyTyped,pocesar/DefinitelyTyped,nobuoka/DefinitelyTyped,Ptival/DefinitelyTyped,jsaelhof/DefinitelyTyped,algas/DefinitelyTyped,schmuli/DefinitelyTyped,duongphuhiep/DefinitelyTyped,zuzusik/DefinitelyTyped,florentpoujol/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,scsouthw/DefinitelyTyped,Shiak1/DefinitelyTyped,use-strict/DefinitelyTyped,YousefED/DefinitelyTyped,abbasmhd/DefinitelyTyped,nainslie/DefinitelyTyped,kalloc/DefinitelyTyped,billccn/DefinitelyTyped,bennett000/DefinitelyTyped,jasonswearingen/DefinitelyTyped,duncanmak/DefinitelyTyped,gedaiu/DefinitelyTyped,OfficeDev/DefinitelyTyped,toedter/DefinitelyTyped,stephenjelfs/DefinitelyTyped,martinduparc/DefinitelyTyped,Riron/DefinitelyTyped,tigerxy/DefinitelyTyped,ArturSoler/DefinitelyTyped,shiwano/DefinitelyTyped,Chris380/DefinitelyTyped,ciriarte/DefinitelyTyped,PawelStroinski/DefinitelyTyped,darkl/DefinitelyTyped,isman-usoh/DefinitelyTyped,anweiss/DefinitelyTyped,NCARalph/DefinitelyTyped,theyelllowdart/DefinitelyTyped,damianog/DefinitelyTyped,michaelbromley/DefinitelyTyped,tscho/DefinitelyTyped,kabogo/DefinitelyTyped,Garciat/DefinitelyTyped,masonkmeyer/DefinitelyTyped,robertbaker/DefinitelyTyped,zuzusik/DefinitelyTyped,Carreau/DefinitelyTyped,drillbits/DefinitelyTyped,glenndierckx/DefinitelyTyped,omidkrad/DefinitelyTyped,angelobelchior8/DefinitelyTyped,algas/DefinitelyTyped,nainslie/DefinitelyTyped,nycdotnet/DefinitelyTyped,bayitajesi/DefinitelyTyped,arusakov/DefinitelyTyped,forumone/DefinitelyTyped,bjfletcher/DefinitelyTyped,zhiyiting/DefinitelyTyped,spearhead-ea/DefinitelyTyped,arma-gast/DefinitelyTyped,Belelros/DefinitelyTyped,richardTowers/DefinitelyTyped,IAPark/DefinitelyTyped,nmalaguti/DefinitelyTyped,chrootsu/DefinitelyTyped,onecentlin/DefinitelyTyped,gandjustas/DefinitelyTyped,Bobjoy/DefinitelyTyped,TheBay0r/DefinitelyTyped,hellopao/DefinitelyTyped,axefrog/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,egeland/DefinitelyTyped,greglo/DefinitelyTyped,alvarorahul/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,smrq/DefinitelyTyped,rcchen/DefinitelyTyped,pwelter34/DefinitelyTyped,mattanja/DefinitelyTyped,lekaha/DefinitelyTyped,gyohk/DefinitelyTyped,musakarakas/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,hafenr/DefinitelyTyped,flyfishMT/DefinitelyTyped,paypac/DefinitelyTyped,balassy/DefinitelyTyped,harcher81/DefinitelyTyped,pocesar/DefinitelyTyped,alexdresko/DefinitelyTyped,ErykB2000/DefinitelyTyped,vincentw56/DefinitelyTyped,munxar/DefinitelyTyped,psnider/DefinitelyTyped,mcrawshaw/DefinitelyTyped,axefrog/DefinitelyTyped,ml-workshare/DefinitelyTyped,harcher81/DefinitelyTyped,nfriend/DefinitelyTyped,rushi216/DefinitelyTyped,Mek7/DefinitelyTyped,icereed/DefinitelyTyped,wilkerlucio/DefinitelyTyped,davidsidlinger/DefinitelyTyped,frogcjn/DefinitelyTyped,ashwinr/DefinitelyTyped,Syati/DefinitelyTyped,paulbakker/DefinitelyTyped,magny/DefinitelyTyped,adamcarr/DefinitelyTyped,dmoonfire/DefinitelyTyped,lseguin42/DefinitelyTyped,PopSugar/DefinitelyTyped,tgfjt/DefinitelyTyped,dydek/DefinitelyTyped,rschmukler/DefinitelyTyped,psnider/DefinitelyTyped,bdukes/DefinitelyTyped,aldo-roman/DefinitelyTyped,harcher81/DefinitelyTyped,greglockwood/DefinitelyTyped,DustinWehr/DefinitelyTyped,Dominator008/DefinitelyTyped,chbrown/DefinitelyTyped,magny/DefinitelyTyped,Penryn/DefinitelyTyped,dragouf/DefinitelyTyped,aciccarello/DefinitelyTyped,bencoveney/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,algorithme/DefinitelyTyped,frogcjn/DefinitelyTyped,adammartin1981/DefinitelyTyped,stephenjelfs/DefinitelyTyped,EnableSoftware/DefinitelyTyped,subash-a/DefinitelyTyped,wcomartin/DefinitelyTyped,mweststrate/DefinitelyTyped,Wordenskjold/DefinitelyTyped,dreampulse/DefinitelyTyped,balassy/DefinitelyTyped,tan9/DefinitelyTyped,Litee/DefinitelyTyped,digitalpixies/DefinitelyTyped,mhegazy/DefinitelyTyped,gcastre/DefinitelyTyped,xStrom/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,nojaf/DefinitelyTyped,optical/DefinitelyTyped,olemp/DefinitelyTyped,mszczepaniak/DefinitelyTyped,AgentME/DefinitelyTyped,nakakura/DefinitelyTyped,chocolatechipui/DefinitelyTyped,minodisk/DefinitelyTyped,muenchdo/DefinitelyTyped,reppners/DefinitelyTyped,bpowers/DefinitelyTyped,teves-castro/DefinitelyTyped,flyfishMT/DefinitelyTyped,jimthedev/DefinitelyTyped,AgentME/DefinitelyTyped,tgrospic/DefinitelyTyped,esperco/DefinitelyTyped,aciccarello/DefinitelyTyped,bobslaede/DefinitelyTyped,robert-voica/DefinitelyTyped,arueckle/DefinitelyTyped,glenndierckx/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,stanislavHamara/DefinitelyTyped,fredgalvao/DefinitelyTyped,Zzzen/DefinitelyTyped,UzEE/DefinitelyTyped,shlomiassaf/DefinitelyTyped,fearthecowboy/DefinitelyTyped,AgentME/DefinitelyTyped,tgrospic/DefinitelyTyped,sledorze/DefinitelyTyped,schmuli/DefinitelyTyped,daptiv/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,michaelbromley/DefinitelyTyped,benishouga/DefinitelyTyped,axefrog/DefinitelyTyped,balassy/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,pocesar/DefinitelyTyped,musicist288/DefinitelyTyped,bdukes/DefinitelyTyped,alainsahli/DefinitelyTyped,tgfjt/DefinitelyTyped,florentpoujol/DefinitelyTyped,Deathspike/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,HPFOD/DefinitelyTyped,uestcNaldo/DefinitelyTyped,aaharu/DefinitelyTyped,acepoblete/DefinitelyTyped,Minishlink/DefinitelyTyped,jeffbcross/DefinitelyTyped,hellopao/DefinitelyTyped,bdoss/DefinitelyTyped,awerlang/DefinitelyTyped,modifyink/DefinitelyTyped,Karabur/DefinitelyTyped,mareek/DefinitelyTyped,bdukes/DefinitelyTyped,johan-gorter/DefinitelyTyped,mattblang/DefinitelyTyped,mshmelev/DefinitelyTyped,akonwi/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,amir-arad/DefinitelyTyped,benishouga/DefinitelyTyped,behzad888/DefinitelyTyped,Zorgatone/DefinitelyTyped,nelsonmorais/DefinitelyTyped,bayitajesi/DefinitelyTyped,M-Zuber/DefinitelyTyped,shovon/DefinitelyTyped,Nemo157/DefinitelyTyped,jsaelhof/DefinitelyTyped,ayanoin/DefinitelyTyped,zensh/DefinitelyTyped,Wordenskjold/DefinitelyTyped,elisee/DefinitelyTyped,philippsimon/DefinitelyTyped,evansolomon/DefinitelyTyped,drinchev/DefinitelyTyped,behzad888/DefinitelyTyped,georgemarshall/DefinitelyTyped,cvrajeesh/DefinitelyTyped,paulbakker/DefinitelyTyped,syntax42/DefinitelyTyped,corps/DefinitelyTyped,isman-usoh/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,stimms/DefinitelyTyped,applesaucers/lodash-invokeMap,wilkerlucio/DefinitelyTyped,danfma/DefinitelyTyped,Penryn/DefinitelyTyped,zuohaocheng/DefinitelyTyped,miguelmq/DefinitelyTyped,mareek/DefinitelyTyped,ajtowf/DefinitelyTyped,shiwano/DefinitelyTyped,EnableSoftware/DefinitelyTyped,nitintutlani/DefinitelyTyped,jpevarnek/DefinitelyTyped,pafflique/DefinitelyTyped,ArturSoler/DefinitelyTyped,OpenMaths/DefinitelyTyped,paxibay/DefinitelyTyped,mshmelev/DefinitelyTyped,gildorwang/DefinitelyTyped,Dashlane/DefinitelyTyped,rerezz/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,martinduparc/DefinitelyTyped,ashwinr/DefinitelyTyped,johnnycrab/DefinitelyTyped,anweiss/DefinitelyTyped,Ridermansb/DefinitelyTyped,hor-crux/DefinitelyTyped,iislucas/DefinitelyTyped,hellopao/DefinitelyTyped,algas/DefinitelyTyped,arcticwaters/DefinitelyTyped
--- +++ @@ -0,0 +1,22 @@ +/// <reference path="dock-spawn.d.ts" /> + +var dockManagerDiv = document.createElement('div'), + panelDiv1 = document.createElement('div'), + panelDiv2 = document.createElement('div'), + panelDiv3 = document.createElement('div'); + +document.body.appendChild(dockManagerDiv); + +var dockManager = new dockspawn.DockManager(dockManagerDiv); +dockManager.initialize(); + +var panelContainer1 = new dockspawn.PanelContainer(panelDiv1, dockManager), + panelContainer2 = new dockspawn.PanelContainer(panelDiv2, dockManager), + panelContainer3 = new dockspawn.PanelContainer(panelDiv3, dockManager); + +var documentNode = dockManager.context.model.documentManagerNode; + +var panelNode1 = dockManager.dockLeft(documentNode, panelContainer1, 0.33), + panelNode2 = dockManager.dockRight(documentNode, panelContainer2, 0.33), + panelNode3 = dockManager.dockFill(documentNode, panelContainer3); +
f880788fade3a79d1f364e73243306e13057a7a3
bids-validator/src/tests/local/common.ts
bids-validator/src/tests/local/common.ts
import { readFileTree } from '../../files/deno.ts' import { FileTree } from '../../types/filetree.ts' import { validate } from '../../validators/bids.ts' import { ValidationResult } from '../../types/validation-result.ts' import { DatasetIssues } from '../../issues/datasetIssues.ts' export async function validatePath( t: Deno.TestContext, path: string, ): Promise<{ tree: FileTree; result: ValidationResult }> { let tree: FileTree = new FileTree('', '') let result: ValidationResult = { issues: new DatasetIssues(), summary: {} } await t.step('file tree is read', async () => { tree = await readFileTree(path) }) await t.step('completes validation', async () => { result = await validate(tree) }) return { tree, result } }
Add helper to quickly write tests for tests/data/... examples
tests: Add helper to quickly write tests for tests/data/... examples
TypeScript
mit
nellh/bids-validator,nellh/bids-validator,nellh/bids-validator
--- +++ @@ -0,0 +1,23 @@ +import { readFileTree } from '../../files/deno.ts' +import { FileTree } from '../../types/filetree.ts' +import { validate } from '../../validators/bids.ts' +import { ValidationResult } from '../../types/validation-result.ts' +import { DatasetIssues } from '../../issues/datasetIssues.ts' + +export async function validatePath( + t: Deno.TestContext, + path: string, +): Promise<{ tree: FileTree; result: ValidationResult }> { + let tree: FileTree = new FileTree('', '') + let result: ValidationResult = { issues: new DatasetIssues(), summary: {} } + + await t.step('file tree is read', async () => { + tree = await readFileTree(path) + }) + + await t.step('completes validation', async () => { + result = await validate(tree) + }) + + return { tree, result } +}
6b06b4cc497c5f95b66267e2e83a0f8081cb5221
test/invalid-iq.ts
test/invalid-iq.ts
import { parse, Registry } from '../src/jxt'; import XMPP, { IQ } from '../src/protocol'; const registry = new Registry(); registry.define(XMPP); test('Invalid IQ - too many children', () => { const xml = parse(` <iq xmlns="jabber:client" type="get"> <query xmlns="http://jabber.org/protocol/disco#info" /> <child xmlns="test2" /> </iq> `); const iq = registry.import(xml)! as IQ; expect(iq.payloadType).toBe('invalid-payload-count'); }); test('Invalid IQ - no children', () => { const xml = parse(` <iq xmlns="jabber:client" type="get"> </iq> `); const iq = registry.import(xml)! as IQ; expect(iq.payloadType).toBe('invalid-payload-count'); }); test('Invalid IQ - unknown payload', () => { const xml = parse(` <iq xmlns="jabber:client" type="get"> <child xmlns="test-dne" /> </iq> `); const iq = registry.import(xml)! as IQ; expect(iq.payloadType).toBe('unknown-payload'); });
Add tests for invalid IQ payloads
Add tests for invalid IQ payloads
TypeScript
mit
otalk/stanza.io,legastero/stanza.io,legastero/stanza.io,otalk/stanza.io
--- +++ @@ -0,0 +1,38 @@ +import { parse, Registry } from '../src/jxt'; +import XMPP, { IQ } from '../src/protocol'; + +const registry = new Registry(); +registry.define(XMPP); + +test('Invalid IQ - too many children', () => { + const xml = parse(` + <iq xmlns="jabber:client" type="get"> + <query xmlns="http://jabber.org/protocol/disco#info" /> + <child xmlns="test2" /> + </iq> + `); + + const iq = registry.import(xml)! as IQ; + expect(iq.payloadType).toBe('invalid-payload-count'); +}); + +test('Invalid IQ - no children', () => { + const xml = parse(` + <iq xmlns="jabber:client" type="get"> + </iq> + `); + + const iq = registry.import(xml)! as IQ; + expect(iq.payloadType).toBe('invalid-payload-count'); +}); + +test('Invalid IQ - unknown payload', () => { + const xml = parse(` + <iq xmlns="jabber:client" type="get"> + <child xmlns="test-dne" /> + </iq> + `); + + const iq = registry.import(xml)! as IQ; + expect(iq.payloadType).toBe('unknown-payload'); +});
db0feb0355de092dbd4072f65fdb899be00acf39
src/tritium/parser/functions.ts
src/tritium/parser/functions.ts
@func Text.sayHi(Text %s) Text @func Text.sayHi(Text %s) { concat("hi ", %s) } @func Text.myConcat(Text %s, Text %t) Text Text @func Text.myConcat(Text %s, Text %t, Text %u) { concat(%s, %t, %u) }
Test input for function parsing.
Test input for function parsing.
TypeScript
mpl-2.0
moovweb/tritium,moovweb/tritium,moovweb/tritium,moovweb/tritium,moovweb/tritium
--- +++ @@ -0,0 +1,11 @@ +@func Text.sayHi(Text %s) Text + +@func Text.sayHi(Text %s) { + concat("hi ", %s) +} + +@func Text.myConcat(Text %s, Text %t) Text Text + +@func Text.myConcat(Text %s, Text %t, Text %u) { + concat(%s, %t, %u) +}
8890230b379819fd9c55c8717b8f14427258f986
ee_tests/src/specs/page_objects/ui/modal_dialog.ts
ee_tests/src/specs/page_objects/ui/modal_dialog.ts
import { ExpectedConditions as until, ElementFinder } from 'protractor'; import { BaseElement } from './base.element'; export class ModalDialog extends BaseElement { content = this.$('.modal-content'); body = this.content.$('.modal-body'); // NOTE: bodyContent is a tag bodyContent = this.body.$('modal-content') constructor(element: ElementFinder, name?: string) { super(element, name); } async ready() { await this.isPresent(); await this.content.isPresent(); await this.body.isPresent(); await this.bodyContent.isPresent(); await this.isDisplayed(); await this.body.isDisplayed(); await this.content.isDisplayed(); await this.bodyContent.isDisplayed(); } async open() { await this.ready(); this.log('Opened') } }
Add Modal Dialog ui element
Add Modal Dialog ui element
TypeScript
apache-2.0
ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test,ldimaggi/fabric8-test
--- +++ @@ -0,0 +1,31 @@ +import { ExpectedConditions as until, ElementFinder } from 'protractor'; +import { BaseElement } from './base.element'; + +export class ModalDialog extends BaseElement { + content = this.$('.modal-content'); + body = this.content.$('.modal-body'); + + // NOTE: bodyContent is a tag + bodyContent = this.body.$('modal-content') + + constructor(element: ElementFinder, name?: string) { + super(element, name); + } + + async ready() { + await this.isPresent(); + await this.content.isPresent(); + await this.body.isPresent(); + await this.bodyContent.isPresent(); + + await this.isDisplayed(); + await this.body.isDisplayed(); + await this.content.isDisplayed(); + await this.bodyContent.isDisplayed(); + } + + async open() { + await this.ready(); + this.log('Opened') + } +}
bbc865b24664e65d9cac81abffef11ef85242d02
server/api/mailer/send-mail.ts
server/api/mailer/send-mail.ts
///<reference path="../../../typings/globals/nodemailer/index.d.ts"/> import { Router, Response, Request, NextFunction } from "express"; import * as nodemailer from "nodemailer" import { MailFunctions } from '../../libs/api/mail-functions' const mailer: Router = Router(); /** * End point for getting all questions of the database */ mailer.post("/send", (request: Request, response: Response) => { let mailfunctions = new MailFunctions(); mailfunctions.sendMail(request.body.recipientMail, request.body.subject, request.body.text, (error, info) =>{ if(error) { response.json({response: error}); } else { response.json({response: info.response}) } }) }); mailer.post("/addQuestions", (request: Request, response: Response) => { let user_name = request.body.user_name; // question.qno = request.body.qno; // question.correct_ans_no = request.body.correct_ans_no; // question.question_time = request.body.question_time; // question.paper_id = request.body.paper_id; // question.subject_id = request.body.subject_id; // question.is_image = request.body.is_image; // question.image_url = request.body.image_url; // question.question = request.body.question; // question.answers = request.body.answers; // dbConnector.connectToDb((error, connection) => { // if (error) { // return response.json({ // err: error // }); // } // else { // console.log('add Questions ', question); // response.json({message: "Inserted Successfully"}); // } // }); }); export { mailer }
Add mail sending API call
Add mail sending API call
TypeScript
mit
shavindraSN/examen,shavindraSN/examen,shavindraSN/examen
--- +++ @@ -0,0 +1,50 @@ +///<reference path="../../../typings/globals/nodemailer/index.d.ts"/> + +import { Router, Response, Request, NextFunction } from "express"; +import * as nodemailer from "nodemailer" +import { MailFunctions } from '../../libs/api/mail-functions' + +const mailer: Router = Router(); +/** + * End point for getting all questions of the database + */ +mailer.post("/send", (request: Request, response: Response) => { + let mailfunctions = new MailFunctions(); + mailfunctions.sendMail(request.body.recipientMail, request.body.subject, request.body.text, (error, info) =>{ + if(error) { + response.json({response: error}); + } + else { + response.json({response: info.response}) + } + }) +}); + + +mailer.post("/addQuestions", (request: Request, response: Response) => { + + let user_name = request.body.user_name; + // question.qno = request.body.qno; + // question.correct_ans_no = request.body.correct_ans_no; + // question.question_time = request.body.question_time; + // question.paper_id = request.body.paper_id; + // question.subject_id = request.body.subject_id; + // question.is_image = request.body.is_image; + // question.image_url = request.body.image_url; + // question.question = request.body.question; + // question.answers = request.body.answers; + + // dbConnector.connectToDb((error, connection) => { + // if (error) { + // return response.json({ + // err: error + // }); + // } + // else { + // console.log('add Questions ', question); + // response.json({message: "Inserted Successfully"}); + // } + // }); +}); + +export { mailer }
9a427c9216f31a796fc17ae42a259c531f67c894
src/Command.ts
src/Command.ts
//import * as fs from "fs"; import Utils from "./Utils"; import Job from "./Job"; import {existsSync, statSync} from "fs"; const executors: Dictionary<(i: Job, a: string[]) => void> = { cd: (job: Job, args: string[]): void => { let newDirectory: string; if (!args.length) { newDirectory = Utils.homeDirectory; } else { newDirectory = Utils.resolveDirectory(job.directory, args[0]); if (!existsSync(newDirectory)) { throw new Error(`The directory ${newDirectory} doesn"t exist.`); } if (!statSync(newDirectory).isDirectory()) { throw new Error(`${newDirectory} is not a directory.`); } } job.terminal.currentDirectory = newDirectory; }, clear: (job: Job, args: string[]): void => { setTimeout(() => job.terminal.clearJobs(), 0); }, exit: (job: Job, args: string[]): void => { // FIXME. }, }; // A class representing built in commands export default class Command { static executor(command: string): (i: Job, args: string[]) => void { return executors[command]; } static isBuiltIn(command: string): boolean { return ["cd", "clear", "exit"].includes(command); } }
import Utils from "./Utils"; import Job from "./Job"; import {existsSync, statSync} from "fs"; const executors: Dictionary<(i: Job, a: string[]) => void> = { cd: (job: Job, args: string[]): void => { let newDirectory: string; if (!args.length) { newDirectory = Utils.homeDirectory; } else { newDirectory = Utils.resolveDirectory(job.directory, args[0]); if (!existsSync(newDirectory)) { throw new Error(`The directory ${newDirectory} doesn"t exist.`); } if (!statSync(newDirectory).isDirectory()) { throw new Error(`${newDirectory} is not a directory.`); } } job.terminal.currentDirectory = newDirectory; }, clear: (job: Job, args: string[]): void => { setTimeout(() => job.terminal.clearJobs(), 0); }, exit: (job: Job, args: string[]): void => { // FIXME. }, }; // A class representing built in commands export default class Command { static executor(command: string): (i: Job, args: string[]) => void { return executors[command]; } static isBuiltIn(command: string): boolean { return ["cd", "clear", "exit"].includes(command); } }
Remove a commented out import.
Remove a commented out import.
TypeScript
mit
railsware/upterm,vshatskyi/black-screen,shockone/black-screen,j-allard/black-screen,shockone/black-screen,drew-gross/black-screen,drew-gross/black-screen,black-screen/black-screen,black-screen/black-screen,black-screen/black-screen,drew-gross/black-screen,vshatskyi/black-screen,vshatskyi/black-screen,drew-gross/black-screen,vshatskyi/black-screen,j-allard/black-screen,j-allard/black-screen,railsware/upterm
--- +++ @@ -1,4 +1,3 @@ -//import * as fs from "fs"; import Utils from "./Utils"; import Job from "./Job"; import {existsSync, statSync} from "fs";
e56a5109697be3b357eebdd5971090e3e496dd96
src/tests/languageTests/general/decoratorTests.ts
src/tests/languageTests/general/decoratorTests.ts
import {getInfoFromString} from "./../../../main"; import {runFileDefinitionTests} from "./../../testHelpers"; describe("decorator arguments tests", () => { const code = ` function MyClassDecorator(target: Function) { } @MyClassDecorator class MyClass1 { } `; const def = getInfoFromString(code); runFileDefinitionTests(def, { functions: [{ name: "MyClassDecorator", parameters: [{ name: "target", type: { text: "Function" } }] }], classes: [{ name: "MyClass1", decorators: [{ name: "MyClassDecorator" }] }] }); });
Add test for decorator without args.
Add test for decorator without args. Not sure why this wasn't here before.
TypeScript
mit
dsherret/type-info-ts,dsherret/ts-type-info,dsherret/ts-type-info,dsherret/type-info-ts
--- +++ @@ -0,0 +1,33 @@ +import {getInfoFromString} from "./../../../main"; +import {runFileDefinitionTests} from "./../../testHelpers"; + +describe("decorator arguments tests", () => { + const code = ` +function MyClassDecorator(target: Function) { +} + +@MyClassDecorator +class MyClass1 { +} +`; + + const def = getInfoFromString(code); + + runFileDefinitionTests(def, { + functions: [{ + name: "MyClassDecorator", + parameters: [{ + name: "target", + type: { + text: "Function" + } + }] + }], + classes: [{ + name: "MyClass1", + decorators: [{ + name: "MyClassDecorator" + }] + }] + }); +});
0e4e1761a3c4c0797b9eb9dfa39b8762546de83e
examples/arduino-uno/button-activated-led.ts
examples/arduino-uno/button-activated-led.ts
import { periodic } from '@amnisio/rivulet'; import { Sources, createSinks, run } from '@amnisio/arduino-uno'; // Sample application that has the on board LED react to a user-provided switch. // The switch is on the D2 pin of the UNO. // Whenever the D2 pin value is HIGH, the on board LED is ON. // Whenever it is not, the on board LED is OFF. // We check the value of the D2 pin every 20ms. const application = (arduino: Sources) => { const sinks = createSinks(); sinks.LED$ = periodic(20).sample(arduino.D2$); return sinks; }; run(application);
Add button activated led sample
Add button activated led sample
TypeScript
mit
artfuldev/RIoT
--- +++ @@ -0,0 +1,15 @@ +import { periodic } from '@amnisio/rivulet'; +import { Sources, createSinks, run } from '@amnisio/arduino-uno'; + +// Sample application that has the on board LED react to a user-provided switch. +// The switch is on the D2 pin of the UNO. +// Whenever the D2 pin value is HIGH, the on board LED is ON. +// Whenever it is not, the on board LED is OFF. +// We check the value of the D2 pin every 20ms. +const application = (arduino: Sources) => { + const sinks = createSinks(); + sinks.LED$ = periodic(20).sample(arduino.D2$); + return sinks; +}; + +run(application);
89e50bdc5a9f470c73d3b55bd46c4b8290e356e1
console/src/app/common/Exceptions/PrometheusError.ts
console/src/app/common/Exceptions/PrometheusError.ts
/** * Handles */ export class PrometheusError extends Error { prometheusResponseStatus: number; constructor(message: string, prometheusResponseStatus: number) { super(message); this.prometheusResponseStatus = prometheusResponseStatus; // NOTE: Setting prototype implicitly in order to prevent invalid convertion to ... // ... custom error class. Object.setPrototypeOf(this, PrometheusError.prototype); } getReason(): string { return this.message; } }
Add custom exception class for Prometheus error.
Add custom exception class for Prometheus error.
TypeScript
mit
emc-mongoose/console,emc-mongoose/console,emc-mongoose/console
--- +++ @@ -0,0 +1,20 @@ +/** + * Handles + */ +export class PrometheusError extends Error { + + prometheusResponseStatus: number; + + constructor(message: string, prometheusResponseStatus: number) { + super(message); + this.prometheusResponseStatus = prometheusResponseStatus; + + // NOTE: Setting prototype implicitly in order to prevent invalid convertion to ... + // ... custom error class. + Object.setPrototypeOf(this, PrometheusError.prototype); + } + + getReason(): string { + return this.message; + } +}
ce427b5f361cffa94742642b1d945a4c443ade3d
desktop/core/src/desktop/js/webComponents/SqlText.ts
desktop/core/src/desktop/js/webComponents/SqlText.ts
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // 'License'); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an 'AS IS' BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import 'regenerator-runtime/runtime'; import SqlText from 'components/SqlText.vue'; import { isDefined, wrap } from 'vue/webComponentWrap'; const NAME = 'sql-text'; wrap(NAME, SqlText); const sqlTextDefined = async (): Promise<void> => await isDefined(NAME); export default sqlTextDefined;
Add a sql-text web component to render formatted SQL
[frontend] Add a sql-text web component to render formatted SQL
TypeScript
apache-2.0
cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue,cloudera/hue
--- +++ @@ -0,0 +1,28 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// 'License'); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'regenerator-runtime/runtime'; + +import SqlText from 'components/SqlText.vue'; +import { isDefined, wrap } from 'vue/webComponentWrap'; + +const NAME = 'sql-text'; + +wrap(NAME, SqlText); + +const sqlTextDefined = async (): Promise<void> => await isDefined(NAME); + +export default sqlTextDefined;
e9e79d733116b039a895add69ca7a5c125e4455e
client/imports/app/app.component.ts
client/imports/app/app.component.ts
import { Component } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Courses } from '../../../both/collections/courses.collection'; import { Course } from '../../../both/models/course.model'; //Import interface /* Import styles */ import template from './app.component.html'; import style from './app.component.scss'; /* Import styles */ @Component({ selector: 'app', template, styles: [style] }) /* export App Component Class with an array of course objects. constructor with zone() connects the changes in the collection into view. */ export class AppComponent { courses: Observable<Course[]>; constructor(){ this.courses = Courses.find({}).zone(); } }
Update File with Imports and Components
Update File with Imports and Components
TypeScript
mit
aztec-developers/PortalPlus,aztec-developers/PortalPlus
--- +++ @@ -0,0 +1,29 @@ +import { Component } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; + +import { Courses } from '../../../both/collections/courses.collection'; +import { Course } from '../../../both/models/course.model'; //Import interface +/* + Import styles +*/ +import template from './app.component.html'; +import style from './app.component.scss'; + +/* + Import styles +*/ +@Component({ + selector: 'app', + template, + styles: [style] +}) +/* +export App Component Class with an array of course objects. +constructor with zone() connects the changes in the collection into view. +*/ +export class AppComponent { + courses: Observable<Course[]>; + constructor(){ + this.courses = Courses.find({}).zone(); + } +}
9babab4dad1771a8e2a3720c982f8652663c8b20
app/src/ui/lib/focus-container.tsx
app/src/ui/lib/focus-container.tsx
import * as React from 'react' import * as classNames from 'classnames' interface IFocusContainerProps { readonly className?: string } interface IFocusContainerState { readonly focusInside: boolean } export class FocusContainer extends React.Component< IFocusContainerProps, IFocusContainerState > { public constructor(props: IFocusContainerProps) { super(props) this.state = { focusInside: false } } private onWrapperRef = (elem: HTMLDivElement) => { if (elem) { elem.addEventListener('focusin', () => { this.setState({ focusInside: true }) }) elem.addEventListener('focusout', () => { this.setState({ focusInside: false }) }) } } public render() { const className = classNames('focus-container', this.props.className, { 'focus-inside': this.state.focusInside, }) return ( <div className={className} ref={this.onWrapperRef}> {this.props.children} </div> ) } }
Add a generic component for tracking whether focus is inside of component
Add a generic component for tracking whether focus is inside of component
TypeScript
mit
kactus-io/kactus,j-f1/forked-desktop,artivilla/desktop,j-f1/forked-desktop,kactus-io/kactus,say25/desktop,shiftkey/desktop,desktop/desktop,desktop/desktop,artivilla/desktop,shiftkey/desktop,shiftkey/desktop,artivilla/desktop,desktop/desktop,kactus-io/kactus,say25/desktop,say25/desktop,shiftkey/desktop,kactus-io/kactus,say25/desktop,j-f1/forked-desktop,artivilla/desktop,desktop/desktop,j-f1/forked-desktop
--- +++ @@ -0,0 +1,44 @@ +import * as React from 'react' +import * as classNames from 'classnames' + +interface IFocusContainerProps { + readonly className?: string +} + +interface IFocusContainerState { + readonly focusInside: boolean +} + +export class FocusContainer extends React.Component< + IFocusContainerProps, + IFocusContainerState +> { + public constructor(props: IFocusContainerProps) { + super(props) + this.state = { focusInside: false } + } + + private onWrapperRef = (elem: HTMLDivElement) => { + if (elem) { + elem.addEventListener('focusin', () => { + this.setState({ focusInside: true }) + }) + + elem.addEventListener('focusout', () => { + this.setState({ focusInside: false }) + }) + } + } + + public render() { + const className = classNames('focus-container', this.props.className, { + 'focus-inside': this.state.focusInside, + }) + + return ( + <div className={className} ref={this.onWrapperRef}> + {this.props.children} + </div> + ) + } +}
99bb59fa7796ed2dc25e7771d916411ebb1b9279
scripts/client-build-stats.ts
scripts/client-build-stats.ts
import { registerTSPaths } from '../server/helpers/register-ts-paths' registerTSPaths() import { readdir, stat } from 'fs-extra' import { join } from 'path' import { root } from '@server/helpers/core-utils' async function run () { const result = { app: await buildResult(join(root(), 'client', 'dist', 'en-US')), embed: await buildResult(join(root(), 'client', 'dist', 'standalone', 'videos')) } console.log(JSON.stringify(result)) } run() .catch(err => console.error(err)) async function buildResult (path: string) { const distFiles = await readdir(path) const files: { [ name: string ]: number } = {} for (const file of distFiles) { const filePath = join(path, file) const statsResult = await stat(filePath) files[file] = statsResult.size } return files }
Add client build stats script
Add client build stats script
TypeScript
agpl-3.0
Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube
--- +++ @@ -0,0 +1,33 @@ +import { registerTSPaths } from '../server/helpers/register-ts-paths' +registerTSPaths() + +import { readdir, stat } from 'fs-extra' +import { join } from 'path' +import { root } from '@server/helpers/core-utils' + +async function run () { + const result = { + app: await buildResult(join(root(), 'client', 'dist', 'en-US')), + embed: await buildResult(join(root(), 'client', 'dist', 'standalone', 'videos')) + } + + console.log(JSON.stringify(result)) +} + +run() + .catch(err => console.error(err)) + +async function buildResult (path: string) { + const distFiles = await readdir(path) + + const files: { [ name: string ]: number } = {} + + for (const file of distFiles) { + const filePath = join(path, file) + + const statsResult = await stat(filePath) + files[file] = statsResult.size + } + + return files +}
ca2e198e90a2b722f86d2344471fa41476e8f7c9
ui/test/logs/reducers/logs.test.ts
ui/test/logs/reducers/logs.test.ts
import reducer, {defaultState} from 'src/logs/reducers' import {setTimeWindow} from 'src/logs/actions' describe('Logs.Reducers', () => { it('can set a time window', () => { const expected = { timeOption: 'now', windowOption: '1h', upper: null, lower: 'now() - 1h', seconds: 3600, } const actual = reducer(defaultState, setTimeWindow(expected)) expect(actual.timeWindow).toBe(expected) }) })
import reducer, {defaultState} from 'src/logs/reducers' import {setTimeWindow, setTimeMarker, setTimeBounds} from 'src/logs/actions' describe('Logs.Reducers', () => { it('can set a time window', () => { const actionPayload = { windowOption: '10m', seconds: 600, } const expected = { timeOption: 'now', windowOption: '10m', upper: null, lower: 'now() - 1m', seconds: 600, } const actual = reducer(defaultState, setTimeWindow(actionPayload)) expect(actual.timeRange).toEqual(expected) }) it('can set a time marker', () => { const actionPayload = { timeOption: '2018-07-10T22:22:21.769Z', } const expected = { timeOption: '2018-07-10T22:22:21.769Z', windowOption: '1m', upper: null, lower: 'now() - 1m', seconds: 60, } const actual = reducer(defaultState, setTimeMarker(actionPayload)) expect(actual.timeRange).toEqual(expected) }) it('can set the time bounds', () => { const payload = { upper: '2018-07-10T22:20:21.769Z', lower: '2018-07-10T22:22:21.769Z', } const expected = { timeOption: 'now', windowOption: '1m', upper: '2018-07-10T22:20:21.769Z', lower: '2018-07-10T22:22:21.769Z', seconds: 60, } const actual = reducer(defaultState, setTimeBounds(payload)) expect(actual.timeRange).toEqual(expected) }) })
Add Tests for new time range reducers
Add Tests for new time range reducers Co-authored-by: Alex Paxton <[email protected]> Co-authored-by: Daniel Campbell <[email protected]>
TypeScript
mit
mark-rushakoff/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,influxdb/influxdb,influxdb/influxdb,nooproblem/influxdb,li-ang/influxdb,influxdata/influxdb,li-ang/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,influxdata/influxdb,nooproblem/influxdb,influxdb/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,influxdb/influxdb
--- +++ @@ -1,17 +1,57 @@ import reducer, {defaultState} from 'src/logs/reducers' -import {setTimeWindow} from 'src/logs/actions' +import {setTimeWindow, setTimeMarker, setTimeBounds} from 'src/logs/actions' describe('Logs.Reducers', () => { it('can set a time window', () => { + const actionPayload = { + windowOption: '10m', + seconds: 600, + } + const expected = { timeOption: 'now', - windowOption: '1h', + windowOption: '10m', upper: null, - lower: 'now() - 1h', - seconds: 3600, + lower: 'now() - 1m', + seconds: 600, } - const actual = reducer(defaultState, setTimeWindow(expected)) - expect(actual.timeWindow).toBe(expected) + const actual = reducer(defaultState, setTimeWindow(actionPayload)) + expect(actual.timeRange).toEqual(expected) + }) + + it('can set a time marker', () => { + const actionPayload = { + timeOption: '2018-07-10T22:22:21.769Z', + } + + const expected = { + timeOption: '2018-07-10T22:22:21.769Z', + windowOption: '1m', + upper: null, + lower: 'now() - 1m', + seconds: 60, + } + + const actual = reducer(defaultState, setTimeMarker(actionPayload)) + expect(actual.timeRange).toEqual(expected) + }) + + it('can set the time bounds', () => { + const payload = { + upper: '2018-07-10T22:20:21.769Z', + lower: '2018-07-10T22:22:21.769Z', + } + + const expected = { + timeOption: 'now', + windowOption: '1m', + upper: '2018-07-10T22:20:21.769Z', + lower: '2018-07-10T22:22:21.769Z', + seconds: 60, + } + + const actual = reducer(defaultState, setTimeBounds(payload)) + expect(actual.timeRange).toEqual(expected) }) })
475120f0956d948434a151c1385805023dce1936
src/fix/autofocus.ts
src/fix/autofocus.ts
/** * When creating components asynchronously (e.g. if using RequireJS to load them), the `autofocus` property will not * work, as the browser will look for elements with this attribute on page load, and the page would have already loaded * by the time the component gets inserted into the DOM. If you still wish to use the `autofocus` property as opposed * to set the focus programmatically by yourself on the appropriate element, you can call this function after your * components have been mounted in the DOM. */ export function autofocus() { if (document.readyState === 'loading') { console.warn('autofocus() has been called while the DOM is still not accessible.' + ' Delaying the call is recommended.') return } if (document.activeElement === null || document.activeElement === document.body) { const focusableElems = Array .from(document.querySelectorAll('[autofocus=""],[autofocus="true"]')) .filter(el => window.getComputedStyle(el).display !== 'none') if (focusableElems.length > 0) { (focusableElems[0] as HTMLElement).focus() } } }
Add fix for auto-focus problem with async. component creation
Add fix for auto-focus problem with async. component creation
TypeScript
agpl-3.0
inad9300/Soil,inad9300/Soil
--- +++ @@ -0,0 +1,24 @@ +/** + * When creating components asynchronously (e.g. if using RequireJS to load them), the `autofocus` property will not + * work, as the browser will look for elements with this attribute on page load, and the page would have already loaded + * by the time the component gets inserted into the DOM. If you still wish to use the `autofocus` property as opposed + * to set the focus programmatically by yourself on the appropriate element, you can call this function after your + * components have been mounted in the DOM. + */ +export function autofocus() { + if (document.readyState === 'loading') { + console.warn('autofocus() has been called while the DOM is still not accessible.' + + ' Delaying the call is recommended.') + return + } + + if (document.activeElement === null || document.activeElement === document.body) { + const focusableElems = Array + .from(document.querySelectorAll('[autofocus=""],[autofocus="true"]')) + .filter(el => window.getComputedStyle(el).display !== 'none') + + if (focusableElems.length > 0) { + (focusableElems[0] as HTMLElement).focus() + } + } +}
c87970ae5d1c5f34406d3993f4b1b48fc225df45
examples/spaceGame.ts
examples/spaceGame.ts
import { Boolean, Number, String, Literal, Array, Tuple, Record, Union, Static } from '../src/index' const Vector = Tuple(Number, Number, Number) type Vector = Static<typeof Vector> const Asteroid = Record({ type: Literal('asteroid'), location: Vector, mass: Number, }) type Asteroid = Static<typeof Asteroid> const Planet = Record({ type: Literal('planet'), location: Vector, mass: Number, population: Number, habitable: Boolean, }) type Planet = Static<typeof Planet> const Rank = Union( Literal('captain'), Literal('first mate'), Literal('officer'), Literal('ensign'), ) type Rank = Static<typeof Rank> const CrewMember = Record({ name: String, age: Number, rank: Rank, home: Planet, }) type CrewMember = Static<typeof CrewMember> const Ship = Record({ type: Literal('ship'), location: Vector, mass: Number, name: String, crew: Array(CrewMember), }) type Ship = Static<typeof Ship> const SpaceObject = Union(Asteroid, Planet, Ship) type SpaceObject = Static<typeof SpaceObject>
Add an examples folder and add the README example to it
Add an examples folder and add the README example to it
TypeScript
mit
typeetfunc/runtypes,pelotom/runtypes,pelotom/runtypes
--- +++ @@ -0,0 +1,48 @@ +import { Boolean, Number, String, Literal, Array, Tuple, Record, Union, Static } from '../src/index' + +const Vector = Tuple(Number, Number, Number) +type Vector = Static<typeof Vector> + +const Asteroid = Record({ + type: Literal('asteroid'), + location: Vector, + mass: Number, +}) +type Asteroid = Static<typeof Asteroid> + +const Planet = Record({ + type: Literal('planet'), + location: Vector, + mass: Number, + population: Number, + habitable: Boolean, +}) +type Planet = Static<typeof Planet> + +const Rank = Union( + Literal('captain'), + Literal('first mate'), + Literal('officer'), + Literal('ensign'), +) +type Rank = Static<typeof Rank> + +const CrewMember = Record({ + name: String, + age: Number, + rank: Rank, + home: Planet, +}) +type CrewMember = Static<typeof CrewMember> + +const Ship = Record({ + type: Literal('ship'), + location: Vector, + mass: Number, + name: String, + crew: Array(CrewMember), +}) +type Ship = Static<typeof Ship> + +const SpaceObject = Union(Asteroid, Planet, Ship) +type SpaceObject = Static<typeof SpaceObject>
454a11124f8a5474885743576df9d66ae0ff1331
tests/test_commissioning_events.ts
tests/test_commissioning_events.ts
import myparser = require('../lib/epcisparser'); import eventtypes = require('../lib/epcisevents'); var assert = require('assert'); var fs = require('fs'); describe('epcisconverter', () => { before(function(){ // before all tests }); describe('parse commissioning events', () => { var events:eventtypes.EPCIS.EpcisEvent[]; before(function () { var xml = fs.readFileSync(__dirname + '/../testdata/1_case_commissioning_events.xml'); var parser = new myparser.EPCIS.EpcisParser(); parser.parse(xml, function(err, res) { assert.equal(null, err); events = res; }); }); it('check the number of elements', (done) => { assert.equal(events.length, 100); done(); }); it('the first element should match our expectations', (done) => { assert.equal(events[0].eventTime, '2006-06-25T00:01:00Z'); assert.equal(events[0].eventTimeZoneOffset, '-06:00'); assert.equal(events[0].epc, 'urn:epc:id:sgtin:0614141.107340.1'); assert.equal(events[0].action, 'ADD'); assert.equal(events[0].bizStep, 'urn:epcglobal:hls:bizstep:commissioning'); assert.equal(events[0].disposition, 'urn:epcglobal:hls:disp:active'); assert.equal(events[0].readPoint, 'urn:epcglobal:fmcg:loc:0614141073467.RP-1'); assert.equal(events[0].bizLocation, 'urn:epcglobal:fmcg:loc:0614141073467.1'); done(); }); it('the last element should match our expectations', (done) => { assert.equal(events[99].eventTime, '2006-06-25T01:40:00Z'); assert.equal(events[99].eventTimeZoneOffset, '-06:00'); assert.equal(events[99].epc, 'urn:epc:id:sgtin:0614142.107349.10'); assert.equal(events[99].action, 'ADD'); assert.equal(events[99].bizStep, 'urn:epcglobal:hls:bizstep:commissioning'); assert.equal(events[99].disposition, 'urn:epcglobal:hls:disp:active'); assert.equal(events[99].readPoint, 'urn:epcglobal:fmcg:loc:0614141073467.RP-1'); assert.equal(events[99].bizLocation, 'urn:epcglobal:fmcg:loc:0614141073467.1'); done(); }); }); });
Add commissioning events test case
Add commissioning events test case
TypeScript
mit
matgnt/epcis-js,matgnt/epcis-js
--- +++ @@ -0,0 +1,55 @@ +import myparser = require('../lib/epcisparser'); +import eventtypes = require('../lib/epcisevents'); +var assert = require('assert'); +var fs = require('fs'); + +describe('epcisconverter', () => { + before(function(){ + // before all tests + }); + + + describe('parse commissioning events', () => { + + var events:eventtypes.EPCIS.EpcisEvent[]; + + before(function () { + var xml = fs.readFileSync(__dirname + '/../testdata/1_case_commissioning_events.xml'); + var parser = new myparser.EPCIS.EpcisParser(); + parser.parse(xml, function(err, res) { + assert.equal(null, err); + events = res; + }); + }); + + it('check the number of elements', (done) => { + assert.equal(events.length, 100); + done(); + }); + + it('the first element should match our expectations', (done) => { + assert.equal(events[0].eventTime, '2006-06-25T00:01:00Z'); + assert.equal(events[0].eventTimeZoneOffset, '-06:00'); + assert.equal(events[0].epc, 'urn:epc:id:sgtin:0614141.107340.1'); + assert.equal(events[0].action, 'ADD'); + assert.equal(events[0].bizStep, 'urn:epcglobal:hls:bizstep:commissioning'); + assert.equal(events[0].disposition, 'urn:epcglobal:hls:disp:active'); + assert.equal(events[0].readPoint, 'urn:epcglobal:fmcg:loc:0614141073467.RP-1'); + assert.equal(events[0].bizLocation, 'urn:epcglobal:fmcg:loc:0614141073467.1'); + done(); + }); + + it('the last element should match our expectations', (done) => { + assert.equal(events[99].eventTime, '2006-06-25T01:40:00Z'); + assert.equal(events[99].eventTimeZoneOffset, '-06:00'); + assert.equal(events[99].epc, 'urn:epc:id:sgtin:0614142.107349.10'); + assert.equal(events[99].action, 'ADD'); + assert.equal(events[99].bizStep, 'urn:epcglobal:hls:bizstep:commissioning'); + assert.equal(events[99].disposition, 'urn:epcglobal:hls:disp:active'); + assert.equal(events[99].readPoint, 'urn:epcglobal:fmcg:loc:0614141073467.RP-1'); + assert.equal(events[99].bizLocation, 'urn:epcglobal:fmcg:loc:0614141073467.1'); + done(); + }); + + }); +});
d2a5819d31ead08a2d8731eceeed0c6d29028218
pg/pg-tests.ts
pg/pg-tests.ts
/// <reference path="pg.d.ts" /> import * as pg from "pg"; var conString = "postgres://username:password@localhost/database"; // https://github.com/brianc/node-pg-types pg.types.setTypeParser(20, (val) => Number(val)); // Client pooling pg.connect(conString, (err, client, done) => { if (err) { return console.error("Error fetching client from pool", err); } client.query("SELECT $1::int AS number", ["1"], (err, result) => { done(); if (err) { return console.error("Error running query", err); } console.log(result.rows[0]["number"]); return null; }); return null; }); // Simple var client = new pg.Client(conString); client.connect((err) => { if (err) { return console.error("Could not connect to postgres", err); } client.query("SELECT NOW() AS 'theTime'", (err, result) => { if (err) { return console.error("Error running query", err); } console.log(result.rows[0]["theTime"]); client.end(); return null; }); return null; });
/// <reference path="pg.d.ts" /> import * as pg from "pg"; var conString = "postgres://username:password@localhost/database"; // https://github.com/brianc/node-pg-types pg.types.setTypeParser(20, (val) => Number(val)); // Client pooling pg.connect(conString, (err, client, done) => { if (err) { return console.error("Error fetching client from pool", err); } client.query("SELECT $1::int AS number", ["1"], (err, result) => { if (err) { done(err); return console.error("Error running query", err); } else { done(); } console.log(result.rows[0]["number"]); return null; }); return null; }); // Simple var client = new pg.Client(conString); client.connect((err) => { if (err) { return console.error("Could not connect to postgres", err); } client.query("SELECT NOW() AS 'theTime'", (err, result) => { if (err) { return console.error("Error running query", err); } console.log(result.rows[0]["theTime"]); client.end(); return null; }); return null; });
Add test for calling done with an argument
Add test for calling done with an argument
TypeScript
mit
paulmorphy/DefinitelyTyped,amanmahajan7/DefinitelyTyped,hellopao/DefinitelyTyped,nainslie/DefinitelyTyped,nycdotnet/DefinitelyTyped,one-pieces/DefinitelyTyped,ryan10132/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,syuilo/DefinitelyTyped,johan-gorter/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,ashwinr/DefinitelyTyped,rolandzwaga/DefinitelyTyped,mareek/DefinitelyTyped,johan-gorter/DefinitelyTyped,smrq/DefinitelyTyped,hellopao/DefinitelyTyped,raijinsetsu/DefinitelyTyped,rolandzwaga/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,borisyankov/DefinitelyTyped,nfriend/DefinitelyTyped,HPFOD/DefinitelyTyped,smrq/DefinitelyTyped,jraymakers/DefinitelyTyped,markogresak/DefinitelyTyped,alvarorahul/DefinitelyTyped,amir-arad/DefinitelyTyped,stephenjelfs/DefinitelyTyped,Litee/DefinitelyTyped,schmuli/DefinitelyTyped,Ptival/DefinitelyTyped,use-strict/DefinitelyTyped,abner/DefinitelyTyped,rcchen/DefinitelyTyped,minodisk/DefinitelyTyped,arusakov/DefinitelyTyped,gandjustas/DefinitelyTyped,micurs/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,newclear/DefinitelyTyped,paulmorphy/DefinitelyTyped,rcchen/DefinitelyTyped,yuit/DefinitelyTyped,psnider/DefinitelyTyped,nainslie/DefinitelyTyped,damianog/DefinitelyTyped,pocesar/DefinitelyTyped,Zzzen/DefinitelyTyped,mhegazy/DefinitelyTyped,QuatroCode/DefinitelyTyped,abbasmhd/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,magny/DefinitelyTyped,emanuelhp/DefinitelyTyped,benliddicott/DefinitelyTyped,aciccarello/DefinitelyTyped,schmuli/DefinitelyTyped,mcliment/DefinitelyTyped,abner/DefinitelyTyped,abbasmhd/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,raijinsetsu/DefinitelyTyped,arma-gast/DefinitelyTyped,hellopao/DefinitelyTyped,Penryn/DefinitelyTyped,stacktracejs/DefinitelyTyped,mcrawshaw/DefinitelyTyped,EnableSoftware/DefinitelyTyped,greglo/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,frogcjn/DefinitelyTyped,psnider/DefinitelyTyped,alexdresko/DefinitelyTyped,frogcjn/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,progre/DefinitelyTyped,mattblang/DefinitelyTyped,yuit/DefinitelyTyped,benishouga/DefinitelyTyped,sledorze/DefinitelyTyped,Litee/DefinitelyTyped,shlomiassaf/DefinitelyTyped,nobuoka/DefinitelyTyped,borisyankov/DefinitelyTyped,donnut/DefinitelyTyped,greglo/DefinitelyTyped,Ptival/DefinitelyTyped,Penryn/DefinitelyTyped,arusakov/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,florentpoujol/DefinitelyTyped,progre/DefinitelyTyped,daptiv/DefinitelyTyped,Zzzen/DefinitelyTyped,georgemarshall/DefinitelyTyped,florentpoujol/DefinitelyTyped,amanmahajan7/DefinitelyTyped,tan9/DefinitelyTyped,scriby/DefinitelyTyped,gcastre/DefinitelyTyped,danfma/DefinitelyTyped,pwelter34/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,pwelter34/DefinitelyTyped,donnut/DefinitelyTyped,chrootsu/DefinitelyTyped,jimthedev/DefinitelyTyped,subash-a/DefinitelyTyped,zuzusik/DefinitelyTyped,stephenjelfs/DefinitelyTyped,zuzusik/DefinitelyTyped,nycdotnet/DefinitelyTyped,pocesar/DefinitelyTyped,mareek/DefinitelyTyped,musicist288/DefinitelyTyped,gandjustas/DefinitelyTyped,mhegazy/DefinitelyTyped,Pro/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,scriby/DefinitelyTyped,HPFOD/DefinitelyTyped,axelcostaspena/DefinitelyTyped,jimthedev/DefinitelyTyped,tan9/DefinitelyTyped,aciccarello/DefinitelyTyped,ashwinr/DefinitelyTyped,georgemarshall/DefinitelyTyped,damianog/DefinitelyTyped,mcrawshaw/DefinitelyTyped,martinduparc/DefinitelyTyped,jimthedev/DefinitelyTyped,YousefED/DefinitelyTyped,chrismbarr/DefinitelyTyped,isman-usoh/DefinitelyTyped,chrismbarr/DefinitelyTyped,subash-a/DefinitelyTyped,AgentME/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,jraymakers/DefinitelyTyped,arusakov/DefinitelyTyped,reppners/DefinitelyTyped,stacktracejs/DefinitelyTyped,AgentME/DefinitelyTyped,YousefED/DefinitelyTyped,aciccarello/DefinitelyTyped,magny/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,pocesar/DefinitelyTyped,syuilo/DefinitelyTyped,sledorze/DefinitelyTyped,mattblang/DefinitelyTyped,minodisk/DefinitelyTyped,Pro/DefinitelyTyped,chrootsu/DefinitelyTyped,benishouga/DefinitelyTyped,reppners/DefinitelyTyped,xStrom/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,gcastre/DefinitelyTyped,danfma/DefinitelyTyped,QuatroCode/DefinitelyTyped,AgentME/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,schmuli/DefinitelyTyped,philippstucki/DefinitelyTyped,use-strict/DefinitelyTyped,georgemarshall/DefinitelyTyped,zuzusik/DefinitelyTyped,philippstucki/DefinitelyTyped,psnider/DefinitelyTyped,shlomiassaf/DefinitelyTyped,isman-usoh/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,nobuoka/DefinitelyTyped,dsebastien/DefinitelyTyped,EnableSoftware/DefinitelyTyped,AgentME/DefinitelyTyped,martinduparc/DefinitelyTyped,xStrom/DefinitelyTyped,newclear/DefinitelyTyped,arma-gast/DefinitelyTyped,benishouga/DefinitelyTyped,emanuelhp/DefinitelyTyped,alvarorahul/DefinitelyTyped,chbrown/DefinitelyTyped,martinduparc/DefinitelyTyped,alexdresko/DefinitelyTyped
--- +++ @@ -12,9 +12,12 @@ return console.error("Error fetching client from pool", err); } client.query("SELECT $1::int AS number", ["1"], (err, result) => { - done(); if (err) { + done(err); return console.error("Error running query", err); + } + else { + done(); } console.log(result.rows[0]["number"]); return null;
d15ae6339654f53ea34c2929829bb70669ef25c9
ts/test-node/util/zkgroup_test.ts
ts/test-node/util/zkgroup_test.ts
// Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import { assert } from 'chai'; import * as fs from 'node:fs'; import path from 'node:path'; import { ServerPublicParams } from '@signalapp/libsignal-client/zkgroup'; describe('zkgroup', () => { describe('serverPublicParams', () => { const configDir = 'config'; for (const file of fs.readdirSync(configDir)) { if (!file.endsWith('.json')) { continue; } const contents = fs.readFileSync(path.join(configDir, file), { encoding: 'utf-8', }); const serverPublicParamsBase64: string | undefined = JSON.parse(contents).serverPublicParams; let test: (() => void) | undefined; if (serverPublicParamsBase64 !== undefined) { test = () => { const serverPublicParams = new ServerPublicParams( Buffer.from(serverPublicParamsBase64, 'base64') ); assert(serverPublicParams); }; } else { // Mark as "pending" / skipped to show we didn't miss a file. test = undefined; } it(`valid in ${file}`, test); } }); });
Test that the zkgroup serverPublicParams are up to date
Test that the zkgroup serverPublicParams are up to date
TypeScript
agpl-3.0
nrizzio/Signal-Desktop,nrizzio/Signal-Desktop,nrizzio/Signal-Desktop,nrizzio/Signal-Desktop
--- +++ @@ -0,0 +1,38 @@ +// Copyright 2022 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import { assert } from 'chai'; +import * as fs from 'node:fs'; +import path from 'node:path'; +import { ServerPublicParams } from '@signalapp/libsignal-client/zkgroup'; + +describe('zkgroup', () => { + describe('serverPublicParams', () => { + const configDir = 'config'; + + for (const file of fs.readdirSync(configDir)) { + if (!file.endsWith('.json')) { + continue; + } + const contents = fs.readFileSync(path.join(configDir, file), { + encoding: 'utf-8', + }); + const serverPublicParamsBase64: string | undefined = + JSON.parse(contents).serverPublicParams; + + let test: (() => void) | undefined; + if (serverPublicParamsBase64 !== undefined) { + test = () => { + const serverPublicParams = new ServerPublicParams( + Buffer.from(serverPublicParamsBase64, 'base64') + ); + assert(serverPublicParams); + }; + } else { + // Mark as "pending" / skipped to show we didn't miss a file. + test = undefined; + } + it(`valid in ${file}`, test); + } + }); +});