Ciao a tutti,
volevo proporvi questo piccolo dilemma in cui mi sono trovato.
Io ho la seguente funzione nel mio main.js
ora nel mio file test.js ho questo codice:codice:function updateProgressBar (val){ $('.player-scrub').slider({ value: val }); //console.log(val); }
il problema č che non ricnonsce l'elemento $('.player-scrub') percheč si trova nella pagina index.html che non ho importato nella mia pagina test.html.codice:test('Test updateProgressbar function', function(){ testBar(23, 23);//pass testBar(80, 80);//pass testBar(74, 75);//should fail function testBar (then, expect) { updateProgressBar(then); equal($('.player-scrub').slider('value'), expect, "The progressBar works properly"); } });
Quindi ho provato ad importarla ma ottengo questo errore:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Comunque quello che vorrei capire eč quindi come testo il cambiamento degli elementi del DOM?
E' giusto importare l'intera pagina HTML?
QUnit serve per testare funzioni javascript dove ritorniamo sempre un valore di ritorno?
Grazie ragazzi e scusate se sono stato un pņ confusionario

Rispondi quotando
