GithubHelp home page GithubHelp logo

isabella232 / wp-qunit-print-script-dependencies Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xwp/wp-qunit-print-script-dependencies

0.0 0.0 0.0 11 KB

QUnit Print Script Dependencies WP-CLI Command

PHP 100.00%

wp-qunit-print-script-dependencies's Introduction

QUnit Print Script Dependencies WP-CLI Command

Print dependencies for scripts to be tested and then add into a QUnit HTML test runner file (see where in the main WP Core QUnit test suite, for example). Uses wp_print_scripts() and will include any attached script data or before/after inline scripts. This eliminates a lot of tedious effort to code up these script tags by hand.

Examples

Print dependencies for wp-a11y:

$ wp qunit-print-script-dependencies wp-a11y
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/jquery/jquery.js?ver=1.12.3'></script>
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/jquery/jquery-migrate.js?ver=1.4.0'></script>
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/wp-a11y.js?ver=4.5.2'></script>

Print dependencies for wp-util:

$ wp qunit-print-script-dependencies wp-util
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/underscore.min.js?ver=1.8.3'></script>
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/jquery/jquery.js?ver=1.12.3'></script>
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/jquery/jquery-migrate.js?ver=1.4.0'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var _wpUtilSettings = {"ajax":{"url":"\/wp-admin\/admin-ajax.php"}};
/* ]]> */
</script>
<script type='text/javascript' src='http://src.wordpress-develop.dev/wp-includes/js/wp-util.js?ver=4.5.2'></script>

Print dependencies for wp-util and media-models with overridden base URL. In this case, it is expected that the script tags would be added to a plugin QUnit test runner located somewhere like wp-content/plugins/foo/tests/qunit:

$ wp qunit-print-script-dependencies media-models wplink --base_href=../../../../../
<script type='text/javascript' src='../../../../../wp-includes/js/underscore.min.js?ver=1.8.3'></script>
<script type='text/javascript' src='../../../../../wp-includes/js/jquery/jquery.js?ver=1.12.3'></script>
<script type='text/javascript' src='../../../../../wp-includes/js/jquery/jquery-migrate.js?ver=1.4.0'></script>
<script type='text/javascript' src='../../../../../wp-includes/js/backbone.min.js?ver=1.2.3'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var _wpUtilSettings = {"ajax":{"url":"\/wp-admin\/admin-ajax.php"}};
/* ]]> */
</script>
<script type='text/javascript' src='../../../../../wp-includes/js/wp-util.js?ver=4.5.2'></script>
<script type='text/javascript' src='../../../../../wp-includes/js/wp-backbone.js?ver=4.5.2'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var _wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}};
/* ]]> */
</script>
<script type='text/javascript' src='../../../../../wp-includes/js/media-models.js?ver=4.5.2'></script>
<script type='text/javascript' src='../../../../../wp-includes/js/wp-a11y.js?ver=4.5.2'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var wpLinkL10n = {"title":"Insert\/edit link","update":"Update","save":"Add Link","noTitle":"(no title)","noMatchesFound":"No results found.","linkSelected":"Link selected.","linkInserted":"Link inserted."};
/* ]]> */
</script>
<script type='text/javascript' src='../../../../../wp-includes/js/wplink.js?ver=4.5.2'></script>

Credits

By XWP. Licensed GPLv2.

wp-qunit-print-script-dependencies's People

Contributors

westonruter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.