]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/Linkifier.test.ts
Merge pull request #733 from Tyriar/732_drop_selection_on_alt
[mirror_xterm.js.git] / src / Linkifier.test.ts
index f4dc9f4dd1e79f01af2ae513ed0a7475c0ec0f01..c6e59d84dba5169aec0bd510a2594e9a05fcba65 100644 (file)
@@ -119,13 +119,19 @@ describe('Linkifier', () => {
       it('should match a link immediately after a link at the end of a text node', done => {
         assertLinkifiesRow('<span>foo bar</span>baz', /bar|baz/, '<span>foo <a>bar</a></span><a>baz</a>', done);
       });
+      it('should not duplicate text after a unicode character (wrapped in a span)', done => {
+        // This is a regression test for an issue that came about when using
+        // an oh-my-zsh theme that added the large blue diamond unicode
+        // character (U+1F537) which caused the path to be duplicated. See #642.
+        assertLinkifiesRow('echo \'<span class="xterm-normal-char">🔷</span>foo\'', /foo/, 'echo \'<span class="xterm-normal-char">🔷</span><a>foo</a>\'', done);
+      });
     });
 
     describe('validationCallback', () => {
       it('should enable link if true', done => {
         addRow('test');
         linkifier.registerLinkMatcher(/test/, () => done(), {
-          validationCallback: (url, cb) => {
+          validationCallback: (url, element, cb) => {
             cb(true);
             assert.equal((<HTMLElement>rows[0].firstChild).tagName, 'A');
             setTimeout(() => clickElement(rows[0].firstChild), 0);
@@ -137,7 +143,7 @@ describe('Linkifier', () => {
       it('should disable link if false', done => {
         addRow('test');
         linkifier.registerLinkMatcher(/test/, () => assert.fail(), {
-          validationCallback: (url, cb) => {
+          validationCallback: (url, element, cb) => {
             cb(false);
             assert.equal((<HTMLElement>rows[0].firstChild).tagName, 'A');
             setTimeout(() => clickElement(rows[0].firstChild), 0);
@@ -152,7 +158,7 @@ describe('Linkifier', () => {
         addRow('test test');
         let count = 0;
         linkifier.registerLinkMatcher(/test/, () => assert.fail(), {
-          validationCallback: (url, cb) => {
+          validationCallback: (url, element, cb) => {
             count += 1;
             if (count === 2) {
               done();