Commits

Shlomi Fish committed a78ae3c

[JS] Implement _flush_changed.

Comments (0)

Files changed (2)

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

     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.');
     });
 }

abc-path/js/abc-path.js

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