- From: Fabian Raetz <fabian.raetz@gmail.com>
- Date: Thu, 30 May 2013 15:18:45 +0200
- To: public-webapps@w3.org
- Message-ID: <CANdX3Oqyc-De8x_Dp7NAOZYxs4eGgKu-yQ-c9dzzQ8N6AdSqeA@mail.gmail.com>
Hi, my name is Fabian Raetz. I'm searching a way to unit test file uploads but i can't find any solutions to that problem on the web. The only way to test file uploads via javascript testing frameworks like Jasmine <http://pivotal.github.io/jasmine/> i've found is via PhantomJS's uploadFile method<https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#wiki-webpage-uploadFile>. It would be awesome if you know a solution that works in Firefox / Chrome Here some pseudo code (not working) that would fit my need: it("should trigger change event", function() { var result, expected = new File(....), // no File Constructor available... maybe with base64 encoded image as input element = jqLite('<input type="file">'); element.bind('change', function(e) { result = e.target.files; }); element.val(expected); // not working.... expect(result.length).toBe(1); expect(result[0]).toEqual(expected); }); Any suggestions? Thanks and Best Regards, Fabian Raetz
Received on Thursday, 30 May 2013 20:55:49 UTC