diff --git a/dist/vuefire.js b/dist/vuefire.js index 25d5c7c4..e18cc285 100644 --- a/dist/vuefire.js +++ b/dist/vuefire.js @@ -166,6 +166,7 @@ return /******/ (function(modules) { // webpackBootstrap */ function bindAsArray (vm, key, source, cancelCallback) { var array = [] + Vue.delete(vm, key) Vue.util.defineReactive(vm, key, array) var onAdd = source.on('child_added', function (snapshot, prevKey) { diff --git a/dist/vuefire.min.js b/dist/vuefire.min.js index 65100abd..0cc1e5e4 100644 --- a/dist/vuefire.min.js +++ b/dist/vuefire.min.js @@ -1 +1 @@ -!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.VueFire=i():e.VueFire=i()}(this,function(){return function(e){function i(n){if(r[n])return r[n].exports;var t=r[n]={exports:{},id:n,loaded:!1};return e[n].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}var r={};return i.m=e,i.c=r,i.p="",i(0)}([function(e,i){function r(e){return"function"==typeof e.key?e.key():e.key}function n(e){return"function"==typeof e.ref?e=e.ref():"object"==typeof e.ref&&(e=e.ref),e}function t(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var i=e.val(),n=t(i)?i:{".value":i};return n[".key"]=r(e),n}function s(e,i){for(var r=0;r
{{ item[".key"] }} {{ item.index }}
', + created: function () { + this.$bindAsArray('items', firebaseRef) + this.$unbind('items') + this.$bindAsArray('items', firebaseRef) + } + }).$mount() + firebaseRef.set({ + first: { index: 0 }, + second: { index: 1 }, + third: { index: 2 } + }, function () { + expect(vm.items).to.deep.equal([ + { '.key': 'first', index: 0 }, + { '.key': 'second', index: 1 }, + { '.key': 'third', index: 2 } + ]) + Vue.nextTick(function () { + expect(vm.$el.textContent).to.contain('first 0 second 1 third 2') + done() + }) + }) + }) + it('binds array records which are primitives', function (done) { var vm = new Vue({ firebase: {