quizzem
Create quizzes within an in-browser text editor
Installing
bower install quizzem --save
Requirements
- AngularJs
- angular-sanitize
- codemirror
- font-awesome
Using
qzm-options
- object
- current takes in a codemirror configuration object
codemirrorOptions: <code mirror options object>
qzm-tests
- array
startingCode: <String> testCode: <String> instructions: <String><String>language: 'JavaScript'
qzm-on-check
- function
- the function will have access to a parameter named
passed
, which is a boolean
ctrl { ctrlpassed = passed; }
Writing Tests
qzm-tests
- did the user create a variable?
- basic javascript syntax errors (including undefined variables) are catched. You can safely reference the name of the variables for tests.
- did the user call a certain method?
- an object called
did
is available ince-tests
. It is made to resemble how methods look (e.g., usedid.angular.module
to test forangular.module()
) and its value is an array of the parameters being sent in to the methods.
bulking up the environment
- eval.js is the web worker that runs the user submitted code
- global scopes inside here is stripped of a lot of objects, whitelist more objects when needed
testEnv()
inside eval.js sets up psuedo objects and methods (e.g.,console
object,angular
object)- psuedo methods in
testEnv()
should push its parameters inside thedid
object