Click here to Skip to main content
15,883,901 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Dealing with browser caching and updated script files Pin
User 171649228-Sep-16 12:31
professionalUser 171649228-Sep-16 12:31 
GeneralRe: Dealing with browser caching and updated script files Pin
Matt U.28-Sep-16 12:33
Matt U.28-Sep-16 12:33 
QuestionHow to grab the value of id from the GET query with JavaScript or jQuery? Pin
Bokleence24-Sep-16 23:17
Bokleence24-Sep-16 23:17 
AnswerRe: How to grab the value of id from the GET query with JavaScript or jQuery? Pin
Afzaal Ahmad Zeeshan24-Sep-16 23:58
professionalAfzaal Ahmad Zeeshan24-Sep-16 23:58 
GeneralRe: How to grab the value of id from the GET query with JavaScript or jQuery? Pin
Bokleence25-Sep-16 0:26
Bokleence25-Sep-16 0:26 
GeneralRe: How to grab the value of id from the GET query with JavaScript or jQuery? Pin
Afzaal Ahmad Zeeshan25-Sep-16 0:37
professionalAfzaal Ahmad Zeeshan25-Sep-16 0:37 
GeneralRe: How to grab the value of id from the GET query with JavaScript or jQuery? Pin
Bokleence25-Sep-16 0:55
Bokleence25-Sep-16 0:55 
QuestionJasmine testing Angular issues Pin
cjb11023-Sep-16 0:04
cjb11023-Sep-16 0:04 
I'm attempting to create jasmine unit tests to an existing Angular web project. But I'm having real problems getting it to work. I'm not very familiar with JavaScript or Angular (far more comfortable in C#), so it could well be a noob mistake.

This is all in Visual Studio 2015 with Jasmine 2.4.1 and Angluar 1.5.8. I'm using the Chutzpah addin to run the tests.

Jasmine works with noddy tests like 2+2 = 4 Big Grin | :-D , but as soon as I try to test the actual app I run into problems.

I started with something simple, testing one of the filters. But I've found 4 different approaches but they all fail with what looks to be internal issues (i.e. not the actual test).
One test is:
describe('Matterhorn 4', function()
{
    describe('SortCodeFilter', function()
    {
        var createFilter;

        beforeEach(angular.mock.module('ngRoute', []));
        beforeEach(angular.mock.module('LocalStorageModule', []));
        beforeEach(angular.mock.module('angular-loading-bar', []));
        beforeEach(angular.mock.module('angularUtils.directives.dirPagination', []));

        beforeEach(function()
        {
            module('MatterhornAuthApp', ['ngRoute', 'LocalStorageModule', 'angular-loading-bar', 'angularUtils.directives.dirPagination']);

            inject(function($injector)
            {
                createFilter = $injector.get('SortCodeFilter');
            });
        });
        
        it('should return stuff', function()
        {
            expect(createFilter('12345')).toBe('01-23-45');
        });
    });
});

I think I understand what this is doing, but it fails with things like
JavaScript
Error: [$injector:modulerr] Failed to instantiate module undefined due to:
[ng:areq] Argument 'fn' is not a function, got undefined


I think its references or dependencies, but I've ran out of files to reference at the top of the testSmile | :) and can't work out how you work out what the dependencies even are!

I suppose I'm used to more help or info being provided by the ide/compiler that helps lead me where to look.
AnswerRe: Jasmine testing Angular issues Pin
cjb11025-Sep-16 22:26
cjb11025-Sep-16 22:26 
QuestionHow to Load Content Without Refreshing Menu Bar. Pin
roraaa_19-Sep-16 23:10
roraaa_19-Sep-16 23:10 
AnswerRe: How to Load Content Without Refreshing Menu Bar. Pin
Nathan Minier20-Sep-16 0:59
professionalNathan Minier20-Sep-16 0:59 
AnswerRe: How to Load Content Without Refreshing Menu Bar. Pin
W Balboos, GHB21-Sep-16 6:07
W Balboos, GHB21-Sep-16 6:07 
Questionunexpected identifier: quick question Pin
shoysmTP19-Sep-16 1:59
shoysmTP19-Sep-16 1:59 
AnswerRe: unexpected identifier: quick question Pin
Richard Deeming19-Sep-16 2:20
mveRichard Deeming19-Sep-16 2:20 
GeneralRe: unexpected identifier: quick question Pin
shoysmTP19-Sep-16 3:56
shoysmTP19-Sep-16 3:56 
Questionjavascript message on web app Pin
dcof16-Sep-16 15:07
dcof16-Sep-16 15:07 
AnswerRe: javascript message on web app Pin
Nathan Minier19-Sep-16 1:39
professionalNathan Minier19-Sep-16 1:39 
QuestionAdding New Button using java script Pin
Member 1274349616-Sep-16 1:29
Member 1274349616-Sep-16 1:29 
AnswerRe: Adding New Button using java script Pin
Nathan Minier16-Sep-16 1:49
professionalNathan Minier16-Sep-16 1:49 
QuestionChatbot js code Pin
SolidSnake71-Sep-16 7:26
SolidSnake71-Sep-16 7:26 
AnswerRe: Chatbot js code Pin
Dominic Burford6-Sep-16 2:51
professionalDominic Burford6-Sep-16 2:51 
AnswerRe: Chatbot js code Pin
ZurdoDev6-Sep-16 6:06
professionalZurdoDev6-Sep-16 6:06 
QuestionHTML and javascript dashboard Pin
Member 1271309731-Aug-16 3:21
Member 1271309731-Aug-16 3:21 
SuggestionRe: HTML and javascript dashboard Pin
Nathan Minier31-Aug-16 8:12
professionalNathan Minier31-Aug-16 8:12 
AnswerRe: HTML and javascript dashboard Pin
W Balboos, GHB14-Sep-16 4:48
W Balboos, GHB14-Sep-16 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.