Merge branch 'enumerable' of https://github.com/DCtheTall/jasmine into main

* Merges #1859 from DCtheTall
* Fixes #1837
This commit is contained in:
Steve Gravrock
2020-10-10 18:01:14 -07:00
3 changed files with 7 additions and 4 deletions

View File

@@ -8380,6 +8380,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
var properties = normalizeKeyValues(propertyNames);
for (var i = 0; i < properties.length; i++) {
descriptor = {
enumerable: true,
get: self.createSpy(baseName + '.' + properties[i][0] + '.get'),
set: self.createSpy(baseName + '.' + properties[i][0] + '.set')
};

View File

@@ -183,14 +183,13 @@ describe('Spies', function() {
var spyObj = env.createSpyObj('base', ['method1'], ['prop1']);
expect(spyObj).toEqual({
method1: jasmine.any(Function)
method1: jasmine.any(Function),
prop1: undefined
});
var descriptor = Object.getOwnPropertyDescriptor(spyObj, 'prop1');
expect(descriptor.get.and.identity).toEqual('base.prop1.get');
expect(descriptor.set.and.identity).toEqual('base.prop1.set');
expect(spyObj.prop1).toBeUndefined();
});
it('creates an object with property names and return values if second object is passed', function() {
@@ -200,7 +199,9 @@ describe('Spies', function() {
});
expect(spyObj).toEqual({
method1: jasmine.any(Function)
method1: jasmine.any(Function),
prop1: 'foo',
prop2: 37
});
expect(spyObj.prop1).toEqual('foo');

View File

@@ -38,6 +38,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
var properties = normalizeKeyValues(propertyNames);
for (var i = 0; i < properties.length; i++) {
descriptor = {
enumerable: true,
get: self.createSpy(baseName + '.' + properties[i][0] + '.get'),
set: self.createSpy(baseName + '.' + properties[i][0] + '.set')
};