unittests/tests/serializers/mockSerializer.js
author hamidouk
Mon, 19 Dec 2011 15:25:22 +0100
branchpopcorn-port
changeset 481 a46cfeee6d77
parent 234 43b198dc932d
permissions -rw-r--r--
using jquery ui draggable changes the state of an element from absolute to relative positioning, which breaks the way our seek button expands itself, so we need to force absolute positioning, quite uglily, using jquery.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
234
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     1
function test_mockSerializer() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     2
  module("Mock Serializer basic tests");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     3
  
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     4
  test("init the serializer with a DataLoader and an url", function() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     5
      var dt = new IriSP.DataLoader();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     6
      var ser = new IriSP.MockSerializer(dt, "http://google.com");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     7
      equal( ser._DataLoader, dt, "The dataloader reference is copied to the object." );
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     8
      equal( ser._url, "http://google.com", "The url has been copied as well." );
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     9
      ok(ser._data, "the mock data is defined");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    10
  });
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    11
  
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    12
  test("check that the serialize and deserialize abstract functions are defined", function() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    13
      var dt = new IriSP.DataLoader();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    14
      var ser = new IriSP.MockSerializer(dt);
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    15
      notEqual(ser.serialize, undefined, ".serialize is defined");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    16
      notEqual(ser.deserialize, undefined, ".deserialize is defined");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    17
  });
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    18
  
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    19
  test("check that the callback is called", function() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    20
      var dt = new IriSP.DataLoader();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    21
      var ser = new IriSP.MockSerializer(dt);
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    22
      var spy = this.spy();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    23
      ser.sync(spy);
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    24
      ok(spy.called, "the callback has been called");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    25
  });
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    26
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    27
};