当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript slate-plain-serializer.deserialize函数代码示例

本文整理汇总了TypeScript中slate-plain-serializer.deserialize函数的典型用法代码示例。如果您正苦于以下问题:TypeScript deserialize函数的具体用法?TypeScript deserialize怎么用?TypeScript deserialize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了deserialize函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('returns no suggestions within regexp', () => {
   const instance = new LanguageProvider(datasource);
   const value = Plain.deserialize('{} ()');
   const range = value.selection.merge({
     anchorOffset: 4,
   });
   const valueWithSelection = value.change().select(range).value;
   const history = [
     {
       query: { refId: '1', expr: '{app="foo"}' },
     },
   ];
   const result = instance.provideCompletionItems(
     {
       text: '',
       prefix: '',
       value: valueWithSelection,
       wrapperClasses: [],
     },
     { history }
   );
   expect(result.context).toBeUndefined();
   expect(result.refresher).toBeUndefined();
   expect(result.suggestions.length).toEqual(0);
 });
开发者ID:CorpGlory,项目名称:grafana,代码行数:25,代码来源:language_provider.test.ts

示例2: it

 it('returns default suggestions with history on emtpty context when history was provided', () => {
   const instance = new LanguageProvider(datasource);
   const value = Plain.deserialize('');
   const history = [
     {
       query: { refId: '1', expr: 'metric' },
     },
   ];
   const result = instance.provideCompletionItems({ text: '', prefix: '', value, wrapperClasses: [] }, { history });
   expect(result.context).toBeUndefined();
   expect(result.refresher).toBeUndefined();
   expect(result.suggestions).toMatchObject([
     {
       label: 'History',
       items: [
         {
           label: 'metric',
         },
       ],
     },
     {
       label: 'Functions',
     },
   ]);
 });
开发者ID:CorpGlory,项目名称:grafana,代码行数:25,代码来源:language_provider.test.ts

示例3: it

 it('keeps closing brace when opening brace is removed and inner values exist', () => {
   const change = Plain.deserialize('time(value)').change();
   let event;
   change.move(5);
   event = new window.KeyboardEvent('keydown', { key: 'Backspace' });
   const handled = handler(event, change);
   expect(handled).toBeFalsy();
 });
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:8,代码来源:braces.test.ts

示例4: it

 it('adds closing braces outside a selector', () => {
   const change = Plain.deserialize('sumrate(metric{namespace="dev", cluster="c1"}[2m])').change();
   let event;
   change.move(3);
   event = new window.KeyboardEvent('keydown', { key: '(' });
   handler(event, change);
   expect(Plain.serialize(change.value)).toEqual('sum(rate(metric{namespace="dev", cluster="c1"}[2m]))');
 });
开发者ID:cboggs,项目名称:grafana,代码行数:8,代码来源:braces.test.ts

示例5: it

 it('does not change the empty value', () => {
   const change = Plain.deserialize('').change();
   const event = new window.KeyboardEvent('keydown', {
     key: 'k',
     ctrlKey: true,
   });
   handler(event, change);
   expect(Plain.serialize(change.value)).toEqual('');
 });
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:9,代码来源:clear.test.ts


注:本文中的slate-plain-serializer.deserialize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。