Added tests for #3981 - Slider label ID gets overwritten #4449

Merged
merged 2 commits into from May 25, 2012

Conversation

Projects
None yet
2 participants
Contributor

jasondscott commented May 25, 2012

Tests for Issue #3981 and PR #4433

Contributor

jasondscott commented May 25, 2012

@johnbender can you review?

@johnbender johnbender commented on an outdated diff May 25, 2012

tests/unit/slider/slider_core.js
+
+ test( "labels that have id keep that id", function() {
+ var slider = $("[for=label-id-slider]");
+ equal(slider.attr("id"), "label-id");
+ });
+
+ test( "labels without an id get an id", function() {
+ var slider = $("[for=empty-string-val-slider]");
+ ok(slider.attr("id"));
@johnbender

johnbender May 25, 2012

Contributor

A few super minor nitpicks

First the third argument to the assertions is a description which is helpful when addressing a broken test.

equal( "foo", "foo" )

becomes

equal( "foo", "foo", "the foos are equal" )

Second, I would check the exact value of the id in the second case.

var slider = $("#empty-string-val-slider"),
    label = $("[for=empty-string-val-slider]");
ok(label.attr("id"), "something" + slider.attr("id"), "the label id matches the slider id" );

Last I think the slider vars are actually the labels right?

Jason Scott Fixed some minor issues with the slider tests
Added messages to tests.
Changed test to check exact value of id instead of existence.
Changed var names to better reflect what they are.
aa4886a

jasondscott merged commit f9f5e34 into jquery:master May 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment