1. Shlomi Fish
  2. abc-path

Commits

Shlomi Fish  committed a78ae3c

[JS] Implement _flush_changed.

  • Participants
  • Parent commits 8c00af0
  • Branches default

Comments (0)

Files changed (2)

File abc-path/js/abc-path-test.js

View file
  • Ignore whitespace
     module("Solver.Board");
 
     test("Solver.Board iter_changed", function() {
-        expect(3);
+        expect(5);
 
         var myboard = new ABC_Path.Solver.Board({});
 
         myboard._inc_changed();
         // TEST
         equals(myboard.getIter_changed(), 2, 'iter_changed is now 2.');
+
+        // TEST
+        equals(myboard._flush_changed(), 2, 'flush_changed returned 2.');
+
+        // TEST
+        equals(myboard.getIter_changed(), 0, 'iter_changed was reset to 0 after flush.');
     });
 }

File abc-path/js/abc-path.js

View file
  • Ignore whitespace
             this.setIter_changed(this.getIter_changed() + 1);
             return;
         },
+        _flush_changed: function() {
+            
+            var ret = this.getIter_changed();
+
+            this.setIter_changed(0);
+
+            return ret;
+        },
     },
 });