All tests working again (including double-late-join)
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports = (HB)->
|
||||
if uid?
|
||||
@uid = uid
|
||||
|
||||
type: "Insert"
|
||||
type: "Operation"
|
||||
|
||||
#
|
||||
# Add an event listener. It depends on the operation which events are supported.
|
||||
@@ -284,13 +284,13 @@ module.exports = (HB)->
|
||||
|
||||
cleanup: ()->
|
||||
# TODO: Debugging
|
||||
if @next_cl?.isDeleted()
|
||||
if @next_cl.isDeleted()
|
||||
# delete all ops that delete this insertion
|
||||
for d in @deleted_by
|
||||
d.cleanup()
|
||||
|
||||
# throw new Error "left is not deleted. inconsistency!, wrararar"
|
||||
# delete origin references to the right
|
||||
# throw new Error "right is not deleted. inconsistency!, wrararar"
|
||||
# change origin references to the right
|
||||
o = @next_cl
|
||||
while o.type isnt "Delimiter"
|
||||
if o.origin is @
|
||||
@@ -479,10 +479,10 @@ module.exports = (HB)->
|
||||
|
||||
applyDelete: ()->
|
||||
super()
|
||||
o = @next_cl
|
||||
o = @prev_cl
|
||||
while o?
|
||||
o.applyDelete()
|
||||
o = o.next_cl
|
||||
o = o.prev_cl
|
||||
undefined
|
||||
|
||||
cleanup: ()->
|
||||
|
||||
@@ -125,19 +125,15 @@ module.exports = (HB)->
|
||||
# TODO: at the moment you don't consider changing of properties.
|
||||
# E.g.: let x = {a:[]}. Then x.a.push 1 wouldn't change anything
|
||||
#
|
||||
toJson: ()->
|
||||
toJson: (transform_to_value = false)->
|
||||
if not @bound_json? or not Object.observe? or true # TODO: currently, you are not watching mutable strings for changes, and, therefore, the @bound_json is not updated. TODO TODO wuawuawua easy
|
||||
val = @val()
|
||||
json = {}
|
||||
for name, o of val
|
||||
if not o?
|
||||
json[name] = o
|
||||
else if o.constructor is {}.constructor
|
||||
json[name] = @val(name).toJson()
|
||||
else if o instanceof types.Operation
|
||||
while o instanceof types.Operation
|
||||
o = o.val()
|
||||
json[name] = o
|
||||
if o instanceof JsonType
|
||||
json[name] = o.toJson(transform_to_value)
|
||||
else if transform_to_value and o instanceof types.Operation
|
||||
json[name] = o.val()
|
||||
else
|
||||
json[name] = o
|
||||
@bound_json = json
|
||||
|
||||
@@ -124,10 +124,10 @@ module.exports = (HB)->
|
||||
type: "WordType"
|
||||
|
||||
applyDelete: ()->
|
||||
o = @beginning
|
||||
o = @end
|
||||
while o?
|
||||
o.applyDelete()
|
||||
o = o.next_cl
|
||||
o = o.prev_cl
|
||||
super()
|
||||
|
||||
cleanup: ()->
|
||||
|
||||
Reference in New Issue
Block a user