-
-
Notifications
You must be signed in to change notification settings - Fork 344
Enabled firebase to be called as function, thus enabling patterns where Firebase ref's are stored in root component #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
5f52e88
852cd5b
327203a
a11bedd
f9c7112
530dfef
3e67330
8af7c23
9846ea9
5c5acc6
5c39b0e
80c24fc
46e7003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,11 @@ var firebaseApp = Firebase.initializeApp({ | |
|
||
describe('VueFire', function () { | ||
var firebaseRef | ||
var firebaseDb | ||
|
||
beforeEach(function (done) { | ||
firebaseRef = firebaseApp.database().ref() | ||
firebaseDb = firebaseApp.database() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be moved inside the |
||
firebaseRef = firebaseDb.ref() | ||
firebaseRef.remove(function (error) { | ||
if (error) { | ||
done(error) | ||
|
@@ -25,6 +27,36 @@ describe('VueFire', function () { | |
}) | ||
}) | ||
|
||
describe('is callable as Function', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The title is missing something about option, which is what you're actually changing. I'd name it something like support Function options |
||
it('returns correct ref on function call', function (done) { | ||
var ChildComponent = Vue.extend({ | ||
name: 'ChildComponent', | ||
firebase: function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't you just use this inside the Vue instance? Wouldn't that be easier? |
||
expect(this.$root.database).to.deep.equal(firebaseDb) | ||
done() | ||
}, | ||
template: '<div>test</div>' | ||
}) | ||
new Vue({ | ||
data: function () { | ||
return { | ||
database: firebaseDb | ||
} | ||
}, | ||
ready: function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
expect('poop').to.equal('notpoop') | ||
}, | ||
components: { | ||
'child-component': ChildComponent | ||
}, | ||
template: '<div><child-component></child-component></div>' | ||
}).$mount() | ||
Vue.nextTick(function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also unnecessary There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Damn, I seem to not have removed my initial attempts at getting the test to work. I'll fix that ASAP. |
||
|
||
}) | ||
}) | ||
}) | ||
|
||
describe('bind as Array', function () { | ||
it('throws error for invalid firebase ref', function () { | ||
helpers.invalidFirebaseRefs.forEach(function (ref) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to move this one line below, so if the function is returning nothing we can skip too