Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More selection cleanup. Deleted some overkill difference specs

  • Loading branch information...
commit a3b40a302d0142f94c19d02e333dc4ba869fb857 1 parent 2dba8f6
@nathansobo authored
View
47 spec/monarch/model/relations/difference_spec.js
@@ -176,53 +176,6 @@ Screw.Unit(function(c) { with(c) {
});
});
- describe("subscription propagation", function() {
- describe("when a subscription is registered for the selection, destroyed, and another subscription is registered", function() {
- var eventType;
-
- scenario("for onInsert callbacks", function() {
- init(function() {
- eventType = "onInsert";
- });
- });
-
- scenario("for onUpdate callbacks", function() {
- init(function() {
- eventType = "onUpdate";
- });
- });
-
- scenario("for onRemove callbacks", function() {
- init(function() {
- eventType = "onRemove";
- });
- });
-
- it("subscribes to its #operand and memoizes tuples, then unsubscribes and clears the memoization, then resubscribes and rememoizes", function() {
- var rightOperand = User.where({age: 28});
- var difference = User.difference(rightOperand);
-
- expect(rightOperand.hasSubscribers()).to(beFalse);
- expect(difference.tuplesById).to(beNull);
-
- var subscription = difference[eventType].call(difference, function() {});
-
- expect(rightOperand.hasSubscribers()).to(beTrue);
- expect(difference.tuplesById).toNot(beNull);
-
- subscription.destroy();
-
- expect(rightOperand.hasSubscribers()).to(beFalse);
- expect(difference.tuplesById).to(beNull);
-
- difference.onUpdate(function() {});
-
- expect(rightOperand.hasSubscribers()).to(beTrue);
- expect(difference.tuplesById).toNot(beNull);
- });
- });
- });
-
describe("when the difference is between two distinct but compatible relations", function() {
var difference, leftOperand, rightOperand, insertCallback, updateCallback, removeCallback;
View
12 spec/monarch/model/relations/selection_spec.js
@@ -119,7 +119,7 @@ Screw.Unit(function(c) { with(c) {
context("when a record is inserted into the selection's operand", function() {
context("when that record matches the predicate", function() {
- it("triggers insert events with the record", function() {
+ it("triggers an insert event with the record", function() {
var record = User.createFromRemote({id: "joe", age: 31});
expect(predicate.evaluate(record)).to(beTrue);
expect(insertCallback).to(haveBeenCalled, withArgs(record));
@@ -127,7 +127,7 @@ Screw.Unit(function(c) { with(c) {
});
context("when that record does not match the predicate", function() {
- it("does not trigger insert events", function() {
+ it("does not an trigger insert event", function() {
var record = User.createFromRemote({id: "mike", age: 22});
expect(predicate.evaluate(record)).to(beFalse);
expect(insertCallback).toNot(haveBeenCalled);
@@ -137,7 +137,7 @@ Screw.Unit(function(c) { with(c) {
context("when a record is removed from the selection's operand", function() {
context("when that record matches the predicate", function() {
- it("triggers remove events with the record", function() {
+ it("triggers a remove event with the record", function() {
var record = selection.first();
record.remotelyDestroyed();
expect(removeCallback).to(haveBeenCalled, withArgs(record));
@@ -163,7 +163,7 @@ Screw.Unit(function(c) { with(c) {
});
context("when the record matches the predicate after the update", function() {
- it("triggers insert events with the updated record", function() {
+ it("triggers an insert event with the updated record", function() {
var oldName = record.fullName();
var newName = "Bing Crosby";
@@ -185,7 +185,7 @@ Screw.Unit(function(c) { with(c) {
});
context("when the record no longer matches the predicate after the update", function() {
- it("triggers remove events with the updated record", function() {
+ it("triggers a remove event with the updated record", function() {
record.remotelyUpdated({age: 34});
expect(predicate.evaluate(record)).to(beFalse);
expect(selection.contains(record)).to(beFalse);
@@ -201,7 +201,7 @@ Screw.Unit(function(c) { with(c) {
});
context("when the record matches the predicate after the update", function() {
- it("triggers insert events with the updated record", function() {
+ it("triggers an insert event with the updated record", function() {
record.update({age: 31});
expect(predicate.evaluate(record)).to(beTrue);
expect(selection.contains(record)).to(beTrue);

0 comments on commit a3b40a3

Please sign in to comment.
Something went wrong with that request. Please try again.