Advertisement
Guest User

jasmine tests

a guest
Jan 24th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function preparePage() {
  3.     $j('#content').hide();
  4. }
  5.  
  6. //function setValueToInput() {
  7. //    $j('#userInput').val('show');
  8. //}
  9.  
  10. //function checkUserInput() {
  11. //    if ($j('#userInput').val() == 'show') {
  12. //        $j('#content').show();
  13. //    }
  14. //}
  15.  
  16. function setUpHTMLFixture() {
  17.         jasmine
  18.         .getFixtures()
  19.         .set(' <p id="proba">T</p> '
  20.             + '<input type="text" id="userInput" class="demo"/> '
  21.             + ' <div id="d">Click here</div> '
  22.             + ' <div id="content"> '
  23.             +   ' <img src="images/canberra_hero_image.jpg" class="pic"/> '
  24.             + ' </div>');
  25. }  
  26.  
  27. describe("Tests for Show Button on Form", function () {
  28.  
  29.     beforeEach(function(){
  30.        
  31.         setUpHTMLFixture();
  32.         preparePage();  
  33.         //loadFixtures('index.html');
  34.     });
  35.  
  36.     afterEach(function () {    
  37.          
  38.     });  
  39.    
  40.     it("simple test", function () {
  41.          
  42.         expect($j('#content')).toBeHidden();
  43.         expect(readFixtures).toBeDefined();
  44.         expect(setFixtures).toBeDefined();
  45.         expect(hello()).toEqual('Hello'); //example of how js is executing -> add it into karma config file
  46.     });
  47.  
  48.     //it("simple test", function () {
  49.     //    jasmine.getFixtures().fixturesPath = 'scripts/fixtures/';
  50.     //    loadFixtures('indexx.html');
  51.     //    expect($j('#dd')).toExist();
  52.        
  53.     //});
  54. });    
  55.  
  56. //GET ALL MATCHERS HERE -> https://github.com/velesin/jasmine-jquery
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement