jakeharding / django-jasmine Goto Github PK
View Code? Open in Web Editor NEWPackage to integrate Jasmine with Django
License: Other
Package to integrate Jasmine with Django
License: Other
Easy enough for us to do, but also easy for you to do to in order to establish this as a default situation. I know that Django's testing framework disables the csrf checking, so would this be legitimate in a testing environment?
Investigate if the jasmine.yml will be able to replace the files.json and support test files in separate directories.
This maybe caused by not loading a default boot.js. Check jasmine docs.
The following statement in the ReadMe is not clear as far as local testing:
django-jasmine also integrates the jasmine-jquery plugin, that provides a set of custom matchers for jQuery framework and an API for handling HTML fixtures in your specs.
Most of the ReadMe seems to be talking about local display of test results (i.e. when the results are rendered to index.html), so I think that the instructions should address things from this angle.
ALSO, I tried using jasmine-jquery commands in my tests, and they failed, of course, because jasmine-jquery wasn't on my local system. I placed it in my "static/js" folder and placed the following script tag as the last of the {# core files #} in base.html: <script type="text/javascript" src="{% static 'jasmine-jquery.js' %}"></script>
. This caused an error because I have to reference jQuery in files.json. When I moved the script tag for jasmine-jquery to AFTER the {# source files #}, everything was then found OK.
I would suggest the following (where DJ_ stands for django-jasmine):
I have urls set up:
url(r'^jtests/', include('django_jasmine.urls')),
and the following in settings.py:
STATIC_URL = '/static/'
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
JASMINE_TEST_DIRECTORY = os.path.join(BASE_DIR, '../tests_jasmine')
(For now the tests are in a directory that is one level above the BASE_DIR.)
The following shows the incorrect script tag that appears in index.html:
Since your instructions say that the tests are to be inside a folder named 'spec', which is to be inside the JASMINE_TEST_DIRECTORY, I don't understand why /spec is not part of the above url for the script tag (not to mention the fact that the urls prefix [in my case jtests] is also included in the url). Also, if the tests can be located in any folder that is designated by JASMINE_TEST_DIRECTORY, then why do the instructions say that the STATIC_URL must be defined in settings? I can see that it could be a problem having the tests located one level above the BASE_DIR, but it seems like the urls qualifier shouldn't be in the script tag.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.