Skip to content

Conversation

@Tyriar
Copy link
Member

@Tyriar Tyriar commented Feb 27, 2017

Fixes #570


This allows consumers to invalidate links:

term.registerLinkMatcher(/\w+\.json/, () => console.log(Date.now()), {
  validationCallback: function (uri, cb) {
    // Only enable URIs that exist on disk
    cb(fs.existsSync(uri));
  }
});

As part of this I also removed PhantomJS in favor of much more lightweight jsdom. This makes the tests far more readable, is way faster to download and run and everything runs through the mocha gulp task so they're included in the coverage report!

The one downside with jsdom is that it doesn't do layouts so we have to fake them in the tests, this is a small price to pay for the benefits though imo.

@Tyriar Tyriar added this to the 2.4.0 milestone Feb 27, 2017
@Tyriar Tyriar self-assigned this Feb 27, 2017
@Tyriar Tyriar requested a review from parisk February 27, 2017 17:49
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 64.43% when pulling d0f36e9 on Tyriar:570_link_validation into cf4da6c on sourcelair:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.7%) to 67.358% when pulling b401992 on Tyriar:570_link_validation into cf4da6c on sourcelair:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.9%) to 67.529% when pulling 356d86a on Tyriar:570_link_validation into 3e5fcf7 on sourcelair:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.9%) to 67.529% when pulling 3542f15 on Tyriar:570_link_validation into 3e5fcf7 on sourcelair:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.8%) to 67.468% when pulling 3542f15 on Tyriar:570_link_validation into 3e5fcf7 on sourcelair:master.

Copy link
Contributor

@parisk parisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I am also fond of ditching Phantom in favor of jsdom.

Just a couple of comments on file naming.

assert = chai.assert
</script>
<script src="build/xterm.js"></script>
<script src="lib/Linkifier.phantom.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change the naming from *.phantom.js to *.jsdom.js?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps, the test harness was meant to be deleted. Fixed in next commit. jsdom tests are now run with the regular tests so no need for a custom name.

</script>
<script src="build/xterm.js"></script>
<script src="lib/Linkifier.phantom.js"></script>
<script src="lib/utils/CharMeasure.phantom.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, should we change the naming from *.phantom.js to *.jsdom.js since we ditched PhantomJS in favor of jsdom?

@coveralls
Copy link

Coverage Status

Coverage increased (+2.8%) to 67.468% when pulling 6990653 on Tyriar:570_link_validation into 3e5fcf7 on sourcelair:master.

@Tyriar Tyriar merged commit c756334 into xtermjs:master Mar 1, 2017
@Tyriar Tyriar deleted the 570_link_validation branch March 1, 2017 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants