Permalink
Browse files

fusejs: Remove unused legacy PrototypeJS files. [jddalton]

  • Loading branch information...
1 parent 18929db commit e7d8241bb477cbf75f890c01146b9484123c87ef @jdalton jdalton committed Feb 1, 2010
View
@@ -1,3 +1,2 @@
.DS_Store
-test/unit/tmp
-pkg
+test/unit/tmp
View
@@ -1,17 +1,13 @@
require 'rake'
-require 'rake/packagetask'
FUSEJS_ROOT = File.expand_path(File.dirname(__FILE__))
FUSEJS_SRC_DIR = File.join(FUSEJS_ROOT, 'src')
FUSEJS_DIST_DIR = File.join(FUSEJS_ROOT, 'dist')
-FUSEJS_PKG_DIR = File.join(FUSEJS_ROOT, 'pkg')
FUSEJS_TEST_DIR = File.join(FUSEJS_ROOT, 'test')
FUSEJS_TMP_DIR = File.join(FUSEJS_TEST_DIR, 'unit', 'tmp')
FUSEJS_VERSION = 'Alpha'
-PROTOTYPE_VERSION = '1.6.0.3'
-
-task :default => [:dist, :dist_helper, :package, :clean_package_source]
+task :default => [:dist]
desc "Builds the distribution."
task :dist do
@@ -25,30 +21,6 @@ task :dist do
end
end
-desc "Builds the updating helper."
-task :dist_helper do
- $:.unshift File.join(FUSEJS_ROOT, 'lib')
- require 'protodoc'
-
- Dir.chdir(File.join(FUSEJS_ROOT, 'ext', 'update_helper')) do
- File.open(File.join(FUSEJS_DIST_DIR, 'prototype_update_helper.js'), 'w+') do |dist|
- dist << Protodoc::Preprocessor.new('prototype_update_helper.js')
- end
- end
-end
-
-Rake::PackageTask.new('fuse', FUSEJS_VERSION) do |package|
- package.need_tar_gz = true
- package.package_dir = FUSEJS_PKG_DIR
- package.package_files.include(
- '[A-Z]*',
- 'dist/fuse.js',
- 'lib/**',
- 'src/**',
- 'test/**'
- )
-end
-
desc "Builds the distribution and the test suite, runs the tests and collects their results."
task :test => [:dist, :test_units]
@@ -84,9 +56,6 @@ task :build_unit_tests => [:dist] do
end
end
-task :clean_package_source do
- rm_rf File.join(FUSEJS_PKG_DIR, "fuse-#{FUSEJS_VERSION}")
-end
desc 'Generates an empty tmp directory for building tests.'
task :clean_tmp do
@@ -1,302 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <title>Prototype Unit test file</title>
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <script src="../../dist/fuse.js" type="text/javascript"></script>
- <script src="../../dist/prototype_update_helper.js" type="text/javascript"></script>
- <script src="../../test/lib/assets/unittest.js" type="text/javascript" charset="utf-8"></script>
- <link rel="stylesheet" href="../../test/lib/assets/test.css" type="text/css" charset="utf-8">
-</head>
-<body>
-<h1>Prototype Unit test file</h1>
-<p>
- Test of deprecation.js
-</p>
-
-<div id="foo">foo</div>
-<div id="bar">bar</div>
-<div id="bla">bla</div>
-
-<!-- Log output -->
-<div id="testlog"> </div>
-
-
-<!-- Tests follow -->
-<script type="text/javascript" charset="utf-8">
- var log = {
- 'message': [],
- 'type': []
- };
-
- prototypeUpdateHelper.notify = prototypeUpdateHelper.notify.wrap(function(proceed, message, type) {
- if (!proceed(message, type)) return; // UpdateHelper#notify return false if the message is not logged.
- log.message.push(message);
- log.type.push(type);
- });
-
- Array.prototype.beforeLast = function() {
- return this[this.length - 2];
- }
-
- Test.Unit.Testcase.addMethods({
- 'assertInfoNotified': function(expected) {
- var actualMessage = log.message.beforeLast() || log.message.last(),
- actualType = log.type.beforeLast() || log.type.last();
- this.assertEqual(expected, actualMessage, 'assertInfoNotified');
- this.assertEqual('info', actualType, 'assertInfoNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertErrorNotified': function(expected) {
- var actualMessage = log.message.beforeLast() || log.message.last(),
- actualType = log.type.beforeLast() || log.type.last();
- this.assertEqual(expected, actualMessage, 'assertErrorNotified');
- this.assertEqual('error', actualType, 'assertErrorNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertWarnNotified': function(expected) {
- var actualMessage = log.message.beforeLast() || log.message.last(),
- actualType = log.type.beforeLast() || log.type.last();
- this.assertEqual(expected, actualMessage, 'assertWarnNotified');
- this.assertEqual('warn', actualType, 'assertWarnNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertNotNotified': function() {
- this.assertEmpty(log.message, 'assertNotNotified');
- this.assertEmpty(log.type, 'assertNotNotified');
- log.message.length = log.type.length = 0;
- },
-
- 'assertEmpty': function(array, message) {
- this.assertEqual(0, array.length, message || '');
- }
- });
-
- new Test.Unit.Runner({
- 'testGetStack': function() {
- this.assertMatch(/prototype_update_helper\.html:\d+\n$/, prototypeUpdateHelper.getStack());
- },
-
- 'testDisplay': function() {
- Toggle.display('foo');
- this.assertInfoNotified('Toggle.display has been deprecated, please use Element.toggle instead.');
-
- Element.show('foo', 'bar', 'bla');
- this.assertErrorNotified('Passing an arbitrary number of elements to Element.show is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.show) or $(id_1, id_2, ...).invoke("show") instead.');
-
- $('foo', 'bar', 'bla').each(Element.hide);
- this.assertNotNotified();
-
- Element.show('foo');
- this.assertNotNotified();
-
- Element.hide('foo', 'bar', 'bla');
- this.assertErrorNotified('Passing an arbitrary number of elements to Element.hide is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.hide) or $(id_1, id_2, ...).invoke("hide") instead.');
-
- Element.toggle('foo', 'bar', 'bla');
- this.assertErrorNotified('Passing an arbitrary number of elements to Element.toggle is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Element.toggle) or $(id_1, id_2, ...).invoke("toggle") instead.');
- },
-
- 'testElementStyle': function() {
- Element.setStyle('foo', { 'fontSize': '18px' });
- this.assertNotNotified();
-
- Element.setStyle('foo', { 'font-size': '18px' });
- this.assertErrorNotified('Use of uncamelized style-property names is no longer supported.\n' +
- 'Use either camelized style-property names or a regular CSS string instead (see online documentation).')
-
- Element.setStyle('foo', 'font-size: 18px;');
- this.assertNotNotified();
-
- $('foo').setStyle({ 'font-size': '18px' });
- this.assertErrorNotified('Use of uncamelized style-property names is no longer supported.\n' +
- 'Use either camelized style-property names or a regular CSS string instead (see online documentation).')
- },
-
- 'testClassNames': function() {
- new Element.ClassNames('foo');
- this.assertInfoNotified('Element.ClassNames has been deprecated.')
-
- $('foo').classNames();
- this.assertInfoNotified('Element#classNames has been deprecated.\n' +
- 'If you need to access CSS class names as an array, try: $w(element.classname).')
-
- Element.getElementsByClassName('foo', 'className');
- this.assertInfoNotified('Element#getElementsByClassName has been deprecated, please use Element#select instead.')
-
- document.getElementsByClassName('className');
- this.assertInfoNotified('document.getElementsByClassName has been deprecated, please use $$ instead.')
- },
-
- 'testDomSelectors': function() {
- Element.childOf('foo', 'bar');
- this.assertInfoNotified('Element#childOf has been deprecated, please use Element#descendantOf instead.');
-
- $('foo').immediateDescendants();
- this.assertInfoNotified('Element#immediateDescendants has been deprecated, please use Element#childElements instead.');
-
- $('foo').getElementsBySelector('a');
- this.assertInfoNotified('Element#getElementsBySelector has been deprecated, please use Element#select instead.');
-
- $('foo').select('a');
- this.assertNotNotified();
- },
-
- 'testField': function() {
- var foo = new Element('input'),
- bar = new Element('input'),
- bla = new Element('input');
-
- Field.clear(foo, bar, bla);
- this.assertErrorNotified('Passing an arbitrary number of elements to Field.clear is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Form.Element.clear) or $(id_1, id_2, ...).invoke("clear") instead.');
-
- Field.present(foo, bar, bla);
- this.assertErrorNotified('Passing an arbitrary number of elements to Field.present is no longer supported.\n' +
- 'Use [id_1, id_2, ...].each(Form.Element.present) or $(id_1, id_2, ...).invoke("present") instead.');
- },
-
- 'testInsertion': function() {
- Insertion.Before('foo', 'text');
- this.assertInfoNotified('Insertion.Before has been deprecated, please use Element#insert instead.');
-
- Insertion.Top('foo', 'text');
- this.assertInfoNotified('Insertion.Top has been deprecated, please use Element#insert instead.');
-
- Insertion.Bottom('foo', 'text');
- this.assertInfoNotified('Insertion.Bottom has been deprecated, please use Element#insert instead.');
-
- Insertion.After('foo', 'text');
- this.assertInfoNotified('Insertion.After has been deprecated, please use Element#insert instead.');
- },
-
- 'testPosition': function() {
- Position.prepare('foo');
- this.assertInfoNotified('Position.prepare has been deprecated.');
-
- Position.within('foo');
- this.assertInfoNotified('Position.within has been deprecated.');
-
- Position.withinIncludingScrolloffsets('foo');
- this.assertInfoNotified('Position.withinIncludingScrolloffsets has been deprecated.');
-
- Position.overlap('foo');
- this.assertInfoNotified('Position.overlap has been deprecated.');
-
- Position.cumulativeOffset('foo');
- this.assertInfoNotified('Position.cumulativeOffset has been deprecated, please use Element#cumulativeOffset instead.');
-
- Position.positionedOffset('foo');
- this.assertInfoNotified('Position.positionedOffset has been deprecated, please use Element#positionedOffset instead.');
-
- Position.absolutize('foo');
- this.assertInfoNotified('Position.absolutize has been deprecated, please use Element#absolutize instead.');
-
- Position.relativize('foo');
- this.assertInfoNotified('Position.relativize has been deprecated, please use Element#relativize instead.');
-
- Position.realOffset('foo');
- this.assertInfoNotified('Position.realOffset has been deprecated, please use Element#cumulativeScrollOffset instead.');
-
- Position.offsetParent('foo');
- this.assertInfoNotified('Position.offsetParent has been deprecated, please use Element#getOffsetParent instead.');
-
- Position.page('foo');
- this.assertInfoNotified('Position.page has been deprecated, please use Element#viewportOffset instead.');
-
- Position.clone('foo', 'bar');
- this.assertInfoNotified('Position.clone has been deprecated, please use Element#clonePosition instead.');
- },
-
- 'testEvent': function() {
- Event.unloadCache();
- this.assertErrorNotified('Event.unloadCache has been deprecated.')
- },
-
- 'testHash': function() {
- Hash.toQueryString({});
- this.assertInfoNotified('Hash.toQueryString has been deprecated.\n' +
- 'Use the instance method Hash#toQueryString or Object.toQueryString instead.');
-
- Hash.toJSON({});
- this.assertErrorNotified('Hash.toJSON has been removed.\n' +
- 'Use the instance method Hash#toJSON or Object.toJSON instead.');
-
- var h = $H({ foo: 2 });
-
- h.remove('foo');
- this.assertErrorNotified('Hash#remove is no longer supported, use Hash#unset instead.\n' +
- 'Please note that Hash#unset only accepts one argument.');
-
- h.merge('foo');
- this.assertWarnNotified('Hash#merge is no longer destructive and now operates on a clone of the Hash instance.\n' + 'If you need a destructive merge, use Hash#update instead.');
-
- h['foo'];
- this.assertErrorNotified('Directly accessing a property of an instance of Hash is no longer supported.\n' +
- 'Please use Hash#get(\'foo\') instead.')
-
- h.foo = 3;
- this.assertErrorNotified('Directly setting a property on an instance of Hash is no longer supported.\n' +
- 'Please use Hash#set(\'foo\', 3) instead.')
-
- h.bar = 'bar';
- h.toJSON();
- this.assertErrorNotified('Directly setting a property on an instance of Hash is no longer supported.\n' +
- 'Please use Hash#set(\'bar\', \'bar\') instead.')
-
- h.bar;
- this.assertErrorNotified('Directly accessing a property of an instance of Hash is no longer supported.\n' +
- 'Please use Hash#get(\'bar\') instead.')
-
- h.baz = 'baz';
- h.bar;
- this.assertErrorNotified('Directly setting a property on an instance of Hash is no longer supported.\n' +
- 'Please use Hash#set(\'baz\', \'baz\') instead.')
-
- h.set('toJSON', 'arg'); // make sure hash methods are not overwritten
- this.assertRespondsTo('toJSON', h)
- },
-
- /* Commented out because Array#inject uses native Array#reduce
- 'testArray': function() {
- var a = [0, 1, 2, 3];
- a.reduce(function(){ });
- this.assertErrorNotified('Array#reduce is no longer supported.\n' +
- 'This is due to an unfortunate naming collision with Mozilla\'s own implementation of Array#reduce which differs completely from Prototype\'s implementation (it\'s in fact similar to Prototype\'s Array#inject).\n' +
- 'Mozilla\'s Array#reduce is already implemented in Firefox 3 (as part of JavaScript 1.8) and is about to be standardized in EcmaScript 3.1.')
- }, */
-
- 'testClass': function() {
- Class.create();
- this.assertInfoNotified('The class API has been fully revised and now allows for mixins and inheritance.\n' +
- 'You can find more about it here: http://prototypejs.org/learn/class-inheritance');
- Class.create({});
- this.assertNotNotified();
- },
-
- 'testLogDeprecationOption': function() {
- prototypeUpdateHelper.logLevel = UpdateHelper.Warn;
- var h = $H({ foo: 2 });
-
- h.merge({ foo: 3 });
- this.assertWarnNotified('Hash#merge is no longer destructive and now operates on a clone of the Hash instance.\n' + 'If you need a destructive merge, use Hash#update instead.');
-
- h.remove('foo');
- this.assertErrorNotified('Hash#remove is no longer supported, use Hash#unset instead.\n' +
- 'Please note that Hash#unset only accepts one argument.');
-
- document.getElementsByClassName('className');
- this.assertNotNotified();
- prototypeUpdateHelper.logLevel = UpdateHelper.Info;
- }
- });
-</script>
-</body>
-</html>
Oops, something went wrong.

0 comments on commit e7d8241

Please sign in to comment.