Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html>
<head>
  <title>JS Bin</title>
  <link href="http://code.jquery.com/qunit/qunit-1.18.0.css" rel="stylesheet"/>
</head>
<body>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>
  <script src="http://code.jquery.com/qunit/qunit-1.18.0.js"></script>
  <script>
    module('$ attributes');
    test('$.fn.css', function(){
            $('#qunit-fixture').html('<span>Content</span><span>Second</span>');
            equal( $('#qunit-fixture span').css('padding-left'), '20px');
            $('#qunit-fixture span').css('paddingLeft', '40px');
            equal( $('#qunit-fixture span').css('padding-left'), '40px','first span set to 40px');
            equal( $('#qunit-fixture span:nth-child(2)').css('padding-left'),'40px', 'second span set to 40px');
        });
        test('$.fn.width', function(){
            $('#qunit-fixture').html('<div class="big-width"><div>Element</div></div>');
            equal( $('#qunit-fixture .big-width div').width(), 1000 - 60, 'width is correct');
        });
        test('$.fn.show and $.fn.hide', function(){
            $('#qunit-fixture').html('<div id="el">text</div>');
            
            equal( $('#el').hide()[0].style.display, 'none');
            equal( $('#el').show()[0].style.display, '');
        });
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
alexisabrilpro
0viewers