@nyaruka/temba-components 0.40.2 → 0.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,6 @@ import {
8
8
  getClip,
9
9
  loadStore,
10
10
  } from './utils.test';
11
- import { range } from '../src/utils';
12
11
  import { CustomEventType } from '../src/interfaces';
13
12
 
14
13
  let clock: any;
@@ -68,10 +67,11 @@ export const clickOption = async (select: Select, index: number) => {
68
67
  `[data-option-index="${index}"]`
69
68
  ) as HTMLDivElement;
70
69
  option.click();
71
- await clock.tick(250);
72
70
  await options.updateComplete;
73
71
  await select.updateComplete;
74
- //checkTimers(clock);
72
+ await clock.runAll();
73
+
74
+ checkTimers(clock);
75
75
  };
76
76
 
77
77
  export const openAndClick = async (select: Select, index: number) => {
@@ -470,6 +470,26 @@ describe('temba-select', () => {
470
470
  await assertScreenshot('select/functions', getClipWithOptions(select));
471
471
  });
472
472
 
473
+ it('should truncate selection if necessesary', async () => {
474
+ const options = [
475
+ {
476
+ name: 'this_is_a_long_selection_to_make_sure_it_truncates',
477
+ value: '0',
478
+ },
479
+ ];
480
+
481
+ const select = await createSelect(
482
+ getSelectHTML(options, {
483
+ value: '0',
484
+ })
485
+ );
486
+
487
+ await assertScreenshot(
488
+ 'select/truncated-selection',
489
+ getClipWithOptions(select)
490
+ );
491
+ });
492
+
473
493
  it('can select expression completion as value', async () => {
474
494
  await loadStore();
475
495
 
@@ -131,7 +131,7 @@ const checkScreenshot = async (filename, excluded, threshold) => {
131
131
  });
132
132
  };
133
133
 
134
- const wireScreenshots = async (page, context, isCI) => {
134
+ const wireScreenshots = async (page, context, wait) => {
135
135
  // clear out any past tests
136
136
  const diffs = path.resolve(SCREENSHOTS, DIFF);
137
137
  const tests = path.resolve(SCREENSHOTS, TEST);
@@ -146,8 +146,7 @@ const wireScreenshots = async (page, context, isCI) => {
146
146
  const testFile = await getPath(TEST, filename);
147
147
  const truthFile = await getPath(TRUTH, filename);
148
148
 
149
- // if we are on ci, wait for fetches to complete
150
- if (isCI) {
149
+ if (wait) {
151
150
  await page.waitForNetworkIdle();
152
151
  }
153
152
 
@@ -322,7 +321,7 @@ export default {
322
321
  headless: true,
323
322
  },
324
323
  createPage: async ({ context, config }) => {
325
- // leave this in for logging on ci
324
+ const wait = !(config["unknown"] || []).includes("--fast");
326
325
  const page = await context.newPage();
327
326
  await page.setUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36");
328
327
  await page.once('load', async () => {
@@ -332,8 +331,7 @@ export default {
332
331
  `,
333
332
  });
334
333
 
335
- const isCI = config.rootDir.indexOf("/Users/runner") === 0;
336
- await wireScreenshots(page, context, isCI);
334
+ await wireScreenshots(page, context, wait);
337
335
  });
338
336
 
339
337