This repository has been archived on 2025-05-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
scratch-html5/test/unit/looksPrimitiveSpec.js
2014-04-09 01:18:14 -07:00

51 lines
1.9 KiB
JavaScript

/* jasmine specs for primitives/LooksPrims.js go here */
describe('LooksPrims', function() {
var looksPrims, targetSpriteMock;
beforeEach(function() {
looksPrims = LooksPrims;
targetSpriteMock = targetMock();
});
describe('showBubble for say', function() {
var sayBlock;
beforeEach(function() {
sayBlock = {'args': ['what to say']};
interp = interpreterMock({'targetSprite': targetSpriteMock }, {'arg': sayBlock});
});
it('should call the showBubble method on the targetedSprite', function() {
spyOn(targetSpriteMock, "showBubble");
showBubble(sayBlock, "say");
expect(targetSpriteMock.showBubble).toHaveBeenCalledWith({args:['what to say']}, 'say');
});
});
describe('showBubble for think', function() {
var thinkBlock;
beforeEach(function() {
thinkBlock = {'args': ['what to think']};
interp = interpreterMock({'targetSprite': targetSpriteMock }, {'arg': thinkBlock});
});
it('should call the showBubble method on the targetedSprite', function() {
spyOn(targetSpriteMock, "showBubble");
showBubble(thinkBlock, "think");
expect(targetSpriteMock.showBubble).toHaveBeenCalledWith({args:['what to think']}, 'think');
});
});
describe('showBubble for ask', function() {
var askBlock;
beforeEach(function() {
askBlock = {'args': ['what to ask']};
interp = interpreterMock({'targetSprite': targetSpriteMock }, {'arg': askBlock});
});
it('should call the showBubble method on the targetedSprite', function() {
spyOn(targetSpriteMock, "showBubble");
showBubble(askBlock, "ask");
expect(targetSpriteMock.showBubble).toHaveBeenCalledWith({args:['what to ask']}, 'ask');
});
});
});