當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。