Test jQuery plugins with QUnit. Write HTML in the #qunit-fixture div, apply your plugin, then assert the DOM result. QUnit resets the fixture between tests to prevent state leakage between individual tests.
Testing with QUnit
<script src="qunit.js"></script>
QUnit.test('highlight plugin', function(assert) {
$('#fixture').highlight();
assert.ok(
$('#fixture').css('background') !== '',
'Background set'
);
});